Skip to Content
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
Explore Skills
Cloud Computing
Microsoft Azure
Amazon Web Services (AWS)
Google Cloud
Cloud Migration
Cloud Deployment
Cloud Platforms
Data Engineering
Data Warehouse
SQL
Apache Spark
Microsoft SQL Server
MySQL
Kafka
Data Lake
Streaming & Messaging
NoSQL Databases
Relational Databases
Data Science
Pandas
R
MATLAB
SAS
D3
Power BI
Tableau
Statistics
Exploratory Data Analysis
Data Visualization
AI & ML
Generative AI
Machine Learning
Artificial Intelligence (AI)
Deep Learning
Reinforcement Learning
Natural Language Processing
TensorFlow
Scikit-Learn
Hyperparameter Tuning
MLOps
Programming Languages
Java
JavaScript
Spring
Python
Go
C#
C++
C
Swift
Rust
Functional Programming
Software Architecture
Object-Oriented
Distributed Systems
Domain-Driven Design
Architectural Patterns
IT/Ops
Kubernetes
Docker
GitHub
Terraform
Continuous Delivery
Continuous Integration
Database Administration
Computer Networking
Operating Systems
IT Certifications
Security
Network Security
Application Security
Incident Response
Zero Trust Model
Disaster Recovery
Penetration Testing / Ethical Hacking
Governance
Malware
Security Architecture
Security Engineering
Security Certifications
Design
Web Design
Graphic Design
Interaction Design
Film & Video
User Experience (UX)
Design Process
Design Tools
Business
Agile
Project Management
Product Management
Marketing
Human Resources
Finance
Team Management
Business Strategy
Digital Transformation
Organizational Leadership
Soft Skills
Professional Communication
Emotional Intelligence
Presentation Skills
Innovation
Critical Thinking
Public Speaking
Collaboration
Personal Productivity
Confidence / Motivation
Features
All features
Verifiable skills
AI Academy
Courses
Certifications
Interactive learning
Live events
Superstreams
Answers
Insights reporting
Radar Blog
Buy Courses
Plans
Sign In
Try Now
O'Reilly Platform
book
러닝 타입스크립트
by
조시 골드버그
,
고승원
January 2023
Beginner to intermediate
372 pages
8h 47m
Korean
Hanbit Media, Inc.
Content preview from
러닝 타입스크립트
63
3
장
유니언과 리터럴
유니언과 리터럴
CHAPTER
3
상수를 제외한 모든 것은 변합니다.
시간이 지나면서 값도 변할 수 있습니다.
2
장에서는 타입 시스템의 개념과 타입 시스템이 변수의 타입을 이해하기 위해 값을 읽는 방법
을 설명했습니다. 이제는 타입스크립트가 해당 값을 바탕으로 추론을 수행하는 두 가지 핵심
개념을 소개하겠습니다.
●
유니언
union
:
값에 허용된 타입을 두 개 이상의 가능한 타입으로 확장하는 것
●
내로잉
narrowing
:
값에 허용된 타입이 하나 이상의 가능한 타입이 되지 않도록 좁히는 것
종합하자면 유니언과 내로잉은 다른 주요 프로그래밍 언어에서는 불가능하지만 타입스크립트
에서는 가능한 ‘코드 정보에 입각한 추론’을 해내는 강력한 개념입니다.
3.1
유니언 타입
유니언 타입
다음
mathematician
변수를 보겠습니다.
let mathematician = Math.random() > 0.5
? undefined
: "Mark Goldberg";
64
1
부
개념
mathematician
은 어떤 타입일까요?
둘 다 잠재적인 타입이긴 하지만 무조건
undefined ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial
You might also like
이펙티브 타입스크립트
Dan Vanderkam
견고한 데이터 엔지니어링
조 라이스, 맷 하우슬리
파이썬으로 살펴보는 아키텍처 패턴
오현석, 해리 퍼시벌, 밥 그레고리
개발자를 위한 머신러닝&딥러닝
로런스 모로니
Publisher Resources
ISBN: 9791169210638