{"id":2110,"date":"2023-09-15T03:10:57","date_gmt":"2023-09-15T03:10:57","guid":{"rendered":"https:\/\/easycodingschool.com\/?p=2110"},"modified":"2023-09-15T03:10:57","modified_gmt":"2023-09-15T03:10:57","slug":"types-as-sets-exploring-typescripts-type-system-with-examples","status":"publish","type":"post","link":"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/","title":{"rendered":"Types as Sets: Exploring TypeScript&#8217;s Type System with Examples"},"content":{"rendered":"<p>In TypeScript, types can be thought of as sets in the sense that they define sets of values that a variable can have. TypeScript&#8217;s type system is designed to help you catch type-related errors at compile-time and provide better code documentation. When you define a type in TypeScript, you are essentially defining a set of values that a variable with that type can take.<\/p>\n<p>Some more examples of using TypeScript types as sets:<\/p>\n<h3>Union Types:<\/h3>\n<p>Creating a type that represents a set of multiple possible values.<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-ts\" data-lang=\"TypeScript\"><code>type Fruit = 'apple' | 'banana' | 'orange';\r\n\r\nlet myFruit: Fruit;\r\nmyFruit = 'apple'; \/\/ Valid\r\nmyFruit = 'grape'; \/\/ Error: Type '\"grape\"' is not assignable to type 'Fruit'.\r\n\r\nIntersection Types: Combining two types to create a new type that represents the intersection of their sets.\r\n\r\ntype Animal = { name: string };\r\ntype Bird = { canFly: boolean };\r\n\r\ntype FlyingBird = Animal &amp; Bird;\r\n\r\nconst eagle: FlyingBird = { name: 'Eagle', canFly: true }; \/\/ Valid\r\nconst penguin: FlyingBird = { name: 'Penguin', canFly: false }; \/\/ Error: Property 'canFly' is missing in type '{ name: string; }' but required in type 'Bird'.<\/code><\/pre>\n<\/div>\n<h3>Enum Types:<\/h3>\n<p>Enumerated types represent a finite set of named values.<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-ts\" data-lang=\"TypeScript\"><code>enum Gender {\r\nMale = 'male',\r\nFemale = 'female',\r\nOther = 'other',\r\n}\r\n\r\nlet myGender: Gender;\r\nmyGender = Gender.Male; \/\/ Valid\r\nmyGender = 'unknown'; \/\/ Error: Type '\"unknown\"' is not assignable to type 'Gender'.<\/code><\/pre>\n<\/div>\n<h3>Generic Types:<\/h3>\n<p>Using generics to create a type that works with different sets of values.<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-ts\" data-lang=\"TypeScript\"><code>type Wrapper = { value: T };\r\n\r\nconst stringWrapper: Wrapper = { value: 'Hello' }; \/\/ Valid\r\nconst numberWrapper: Wrapper = { value: 42 }; \/\/ Valid\r\nconst booleanWrapper: Wrapper = { value: true }; \/\/ Valid\r\n\r\nFunction Types: Defining types for functions, which represent sets of valid function signatures.\r\n\r\ntype AddFunction = (a: number, b: number) =&gt; number;\r\n\r\nconst add: AddFunction = (x, y) =&gt; x + y; \/\/ Valid\r\nconst subtract: AddFunction = (x, y) =&gt; x - y; \/\/ Error: Type '(x: number, y: number) =&gt; number' is not assignable to type 'AddFunction'.<\/code><\/pre>\n<\/div>\n<h3>Mapped Types:<\/h3>\n<p>Mapped types allow you to create new types based on the keys of an existing type.<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-ts\" data-lang=\"TypeScript\"><code>type User = {\r\nid: number;\r\nusername: string;\r\nemail: string;\r\n};\r\n\r\ntype UserKeys = keyof User; \/\/ \"id\" | \"username\" | \"email\"\r\n\r\nconst key: UserKeys = \"username\"; \/\/ Valid\r\nconst invalidKey: UserKeys = \"age\"; \/\/ Error: Type '\"age\"' is not assignable to type '\"id\" | \"username\" | \"email\"'.\r\n\r\nConditional Types: Conditional types allow you to create types that depend on a condition.\r\n\r\ntype IsString = T extends string ? true : false;\r\n\r\ntype A = IsString; \/\/ true\r\ntype B = IsString; \/\/ false\r\n\r\nTuple Types: Types that represent arrays with specific lengths and element types.\r\ntype Point2D = [number, number];\r\n\r\nconst point: Point2D = [1, 2]; \/\/ Valid\r\nconst invalidPoint: Point2D = [1, \"2\"]; \/\/ Error: Type 'string' is not assignable to type 'number'.<\/code><\/pre>\n<\/div>\n<h3>Record Types:<\/h3>\n<p>Types for objects with a fixed set of keys and value types.<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-ts\" data-lang=\"TypeScript\"><code>type Person = {\r\nname: string;\r\nage: number;\r\n};\r\n\r\nconst person: Record = {\r\nname: \"John\",\r\nage: 30,\r\n}; \/\/ Valid\r\nconst invalidPerson: Record = {\r\nname: \"John\",\r\nage: \"30\",\r\n}; \/\/ Error: Type 'string' is not assignable to type 'number'.<\/code><\/pre>\n<\/div>\n<h3>Type Aliases:<\/h3>\n<p>Creating a new type that is a union or intersection of existing types.<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-ts\" data-lang=\"TypeScript\"><code>type Circle = { kind: \"circle\"; radius: number };\r\ntype Square = { kind: \"square\"; sideLength: number };\r\ntype Shape = Circle | Square;\r\n\r\nconst circle: Shape = { kind: \"circle\", radius: 5 }; \/\/ Valid\r\nconst triangle: Shape = { kind: \"triangle\", base: 4 }; \/\/ Error: Object literal may only specify known properties...<\/code><\/pre>\n<\/div>\n<h3>Conditional Type with Generics:<\/h3>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-ts\" data-lang=\"TypeScript\"><code>type MyConditionalType = T extends string ? number : boolean;\r\n\r\nconst result1: MyConditionalType = 42; \/\/ Valid\r\nconst result2: MyConditionalType = true; \/\/ Valid\r\nconst result3: MyConditionalType = \"hello\"; \/\/ Valid\r\nconst result4: MyConditionalType&lt;string[]&gt; = false; \/\/ Valid<\/code><\/pre>\n<\/div>\n<p>These examples show how the TypeScript type system may be used to build and manipulate sets of values, specify restrictions, and improve type safety in your code.<\/p>\n<p><span>You can also discover a lot about\u00a0<\/span><a href=\"https:\/\/easycodingschool.com\/blog\/category\/javascript\/\">Javascript by exploring<span>\u00a0<\/span><\/a><span>different topics.<\/span><\/p>\n<p><strong>Note:<\/strong><span>\u00a0We welcome your feedback at\u00a0<\/span><a href=\"https:\/\/easycodingschool.com\/blog\/\">Easy Coding School<\/a><span>. Please don\u2019t hesitate to share your\u00a0<\/span><a href=\"https:\/\/easycodingschool.com\/blog\/contact\/\" target=\"_blank\" rel=\"noopener\">suggestions<\/a><span>\u00a0or any issues you might have with the article!<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In TypeScript, types can be thought of as sets in the sense that they define sets of values that a variable can have. TypeScript&#8217;s type system is designed [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2111,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_themeisle_gutenberg_block_has_review":false,"footnotes":""},"categories":[87,25,175],"tags":[127,108,126,64,24,139,188,184,182,178],"class_list":["post-2110","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-development","category-programming","category-typescript","tag-easy-coding","tag-easy-coding-school","tag-easycoding","tag-easycodingschool","tag-programming","tag-programming-courses","tag-types-as-sets","tag-typescript","tag-typescript-basic","tag-typescript-tutorial"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Types as Sets: Exploring TypeScript&#039;s Type System with Examples - Easy Coding School<\/title>\n<meta name=\"description\" content=\"Discover the power of TypeScript&#039;s type system as we delve into the concept of &#039;Types as Sets.&#039; Explore examples illustrating how TypeScript enables you to define, manipulate, and enforce sets of values, enhancing code safety and clarity.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Types as Sets: Exploring TypeScript&#039;s Type System with Examples - Easy Coding School\" \/>\n<meta property=\"og:description\" content=\"Discover the power of TypeScript&#039;s type system as we delve into the concept of &#039;Types as Sets.&#039; Explore examples illustrating how TypeScript enables you to define, manipulate, and enforce sets of values, enhancing code safety and clarity.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/\" \/>\n<meta property=\"og:site_name\" content=\"Easy Coding School\" \/>\n<meta property=\"article:published_time\" content=\"2023-09-15T03:10:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/easycodingschool.com\/blog\/wp-content\/uploads\/2023\/09\/Types-as-Sets_-Exploring-TypeScripts-Type-System-with-Examples.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"660\" \/>\n\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"gauravkumarjha19@gmail.com\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"gauravkumarjha19@gmail.com\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/\"},\"author\":{\"name\":\"gauravkumarjha19@gmail.com\",\"@id\":\"https:\/\/easycodingschool.com\/blog\/#\/schema\/person\/9cabe8e90728da7f26676cbd1744558b\"},\"headline\":\"Types as Sets: Exploring TypeScript&#8217;s Type System with Examples\",\"datePublished\":\"2023-09-15T03:10:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/\"},\"wordCount\":239,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/easycodingschool.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/easycodingschool.com\/blog\/wp-content\/uploads\/2023\/09\/Types-as-Sets_-Exploring-TypeScripts-Type-System-with-Examples.jpg\",\"keywords\":[\"Easy Coding\",\"Easy Coding School\",\"EasyCoding\",\"EasyCodingSchool\",\"Programming\",\"Programming Courses\",\"Types as Sets\",\"Typescript\",\"typescript basic\",\"typescript tutorial\"],\"articleSection\":[\"Development\",\"Programming\",\"TypeScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/\",\"url\":\"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/\",\"name\":\"Types as Sets: Exploring TypeScript's Type System with Examples - Easy Coding School\",\"isPartOf\":{\"@id\":\"https:\/\/easycodingschool.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/easycodingschool.com\/blog\/wp-content\/uploads\/2023\/09\/Types-as-Sets_-Exploring-TypeScripts-Type-System-with-Examples.jpg\",\"datePublished\":\"2023-09-15T03:10:57+00:00\",\"description\":\"Discover the power of TypeScript's type system as we delve into the concept of 'Types as Sets.' Explore examples illustrating how TypeScript enables you to define, manipulate, and enforce sets of values, enhancing code safety and clarity.\",\"breadcrumb\":{\"@id\":\"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/#primaryimage\",\"url\":\"https:\/\/easycodingschool.com\/blog\/wp-content\/uploads\/2023\/09\/Types-as-Sets_-Exploring-TypeScripts-Type-System-with-Examples.jpg\",\"contentUrl\":\"https:\/\/easycodingschool.com\/blog\/wp-content\/uploads\/2023\/09\/Types-as-Sets_-Exploring-TypeScripts-Type-System-with-Examples.jpg\",\"width\":660,\"height\":350,\"caption\":\"Types as Sets: Exploring TypeScript's Type System with Examples\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/easycodingschool.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Types as Sets: Exploring TypeScript&#8217;s Type System with Examples\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/easycodingschool.com\/blog\/#website\",\"url\":\"https:\/\/easycodingschool.com\/blog\/\",\"name\":\"Easy Coding School\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/easycodingschool.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/easycodingschool.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/easycodingschool.com\/blog\/#organization\",\"name\":\"Easy Coding School\",\"url\":\"https:\/\/easycodingschool.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/easycodingschool.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/easycodingschool.com\/blog\/wp-content\/uploads\/2023\/07\/New-Project-10.png\",\"contentUrl\":\"https:\/\/easycodingschool.com\/blog\/wp-content\/uploads\/2023\/07\/New-Project-10.png\",\"width\":310,\"height\":114,\"caption\":\"Easy Coding School \"},\"image\":{\"@id\":\"https:\/\/easycodingschool.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/easycodingschool.com\/blog\/#\/schema\/person\/9cabe8e90728da7f26676cbd1744558b\",\"name\":\"gauravkumarjha19@gmail.com\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/easycodingschool.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6846a3cc9bd6cb5b779aef260fe379c4b93fa20e1a4c753eb023ff7c08d7c668?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6846a3cc9bd6cb5b779aef260fe379c4b93fa20e1a4c753eb023ff7c08d7c668?s=96&d=mm&r=g\",\"caption\":\"gauravkumarjha19@gmail.com\"},\"sameAs\":[\"https:\/\/easycodingschool.com\/blog\"],\"url\":\"https:\/\/easycodingschool.com\/blog\/author\/gauravkumarjha19gmail-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Types as Sets: Exploring TypeScript's Type System with Examples - Easy Coding School","description":"Discover the power of TypeScript's type system as we delve into the concept of 'Types as Sets.' Explore examples illustrating how TypeScript enables you to define, manipulate, and enforce sets of values, enhancing code safety and clarity.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/","og_locale":"en_US","og_type":"article","og_title":"Types as Sets: Exploring TypeScript's Type System with Examples - Easy Coding School","og_description":"Discover the power of TypeScript's type system as we delve into the concept of 'Types as Sets.' Explore examples illustrating how TypeScript enables you to define, manipulate, and enforce sets of values, enhancing code safety and clarity.","og_url":"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/","og_site_name":"Easy Coding School","article_published_time":"2023-09-15T03:10:57+00:00","og_image":[{"width":660,"height":350,"url":"https:\/\/easycodingschool.com\/blog\/wp-content\/uploads\/2023\/09\/Types-as-Sets_-Exploring-TypeScripts-Type-System-with-Examples.jpg","type":"image\/jpeg"}],"author":"gauravkumarjha19@gmail.com","twitter_card":"summary_large_image","twitter_misc":{"Written by":"gauravkumarjha19@gmail.com","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/#article","isPartOf":{"@id":"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/"},"author":{"name":"gauravkumarjha19@gmail.com","@id":"https:\/\/easycodingschool.com\/blog\/#\/schema\/person\/9cabe8e90728da7f26676cbd1744558b"},"headline":"Types as Sets: Exploring TypeScript&#8217;s Type System with Examples","datePublished":"2023-09-15T03:10:57+00:00","mainEntityOfPage":{"@id":"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/"},"wordCount":239,"commentCount":1,"publisher":{"@id":"https:\/\/easycodingschool.com\/blog\/#organization"},"image":{"@id":"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/#primaryimage"},"thumbnailUrl":"https:\/\/easycodingschool.com\/blog\/wp-content\/uploads\/2023\/09\/Types-as-Sets_-Exploring-TypeScripts-Type-System-with-Examples.jpg","keywords":["Easy Coding","Easy Coding School","EasyCoding","EasyCodingSchool","Programming","Programming Courses","Types as Sets","Typescript","typescript basic","typescript tutorial"],"articleSection":["Development","Programming","TypeScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/","url":"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/","name":"Types as Sets: Exploring TypeScript's Type System with Examples - Easy Coding School","isPartOf":{"@id":"https:\/\/easycodingschool.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/#primaryimage"},"image":{"@id":"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/#primaryimage"},"thumbnailUrl":"https:\/\/easycodingschool.com\/blog\/wp-content\/uploads\/2023\/09\/Types-as-Sets_-Exploring-TypeScripts-Type-System-with-Examples.jpg","datePublished":"2023-09-15T03:10:57+00:00","description":"Discover the power of TypeScript's type system as we delve into the concept of 'Types as Sets.' Explore examples illustrating how TypeScript enables you to define, manipulate, and enforce sets of values, enhancing code safety and clarity.","breadcrumb":{"@id":"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/#primaryimage","url":"https:\/\/easycodingschool.com\/blog\/wp-content\/uploads\/2023\/09\/Types-as-Sets_-Exploring-TypeScripts-Type-System-with-Examples.jpg","contentUrl":"https:\/\/easycodingschool.com\/blog\/wp-content\/uploads\/2023\/09\/Types-as-Sets_-Exploring-TypeScripts-Type-System-with-Examples.jpg","width":660,"height":350,"caption":"Types as Sets: Exploring TypeScript's Type System with Examples"},{"@type":"BreadcrumbList","@id":"https:\/\/easycodingschool.com\/blog\/types-as-sets-exploring-typescripts-type-system-with-examples\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/easycodingschool.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Types as Sets: Exploring TypeScript&#8217;s Type System with Examples"}]},{"@type":"WebSite","@id":"https:\/\/easycodingschool.com\/blog\/#website","url":"https:\/\/easycodingschool.com\/blog\/","name":"Easy Coding School","description":"","publisher":{"@id":"https:\/\/easycodingschool.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/easycodingschool.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/easycodingschool.com\/blog\/#organization","name":"Easy Coding School","url":"https:\/\/easycodingschool.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/easycodingschool.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/easycodingschool.com\/blog\/wp-content\/uploads\/2023\/07\/New-Project-10.png","contentUrl":"https:\/\/easycodingschool.com\/blog\/wp-content\/uploads\/2023\/07\/New-Project-10.png","width":310,"height":114,"caption":"Easy Coding School "},"image":{"@id":"https:\/\/easycodingschool.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/easycodingschool.com\/blog\/#\/schema\/person\/9cabe8e90728da7f26676cbd1744558b","name":"gauravkumarjha19@gmail.com","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/easycodingschool.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6846a3cc9bd6cb5b779aef260fe379c4b93fa20e1a4c753eb023ff7c08d7c668?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6846a3cc9bd6cb5b779aef260fe379c4b93fa20e1a4c753eb023ff7c08d7c668?s=96&d=mm&r=g","caption":"gauravkumarjha19@gmail.com"},"sameAs":["https:\/\/easycodingschool.com\/blog"],"url":"https:\/\/easycodingschool.com\/blog\/author\/gauravkumarjha19gmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/easycodingschool.com\/blog\/wp-json\/wp\/v2\/posts\/2110","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/easycodingschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/easycodingschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/easycodingschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/easycodingschool.com\/blog\/wp-json\/wp\/v2\/comments?post=2110"}],"version-history":[{"count":1,"href":"https:\/\/easycodingschool.com\/blog\/wp-json\/wp\/v2\/posts\/2110\/revisions"}],"predecessor-version":[{"id":2112,"href":"https:\/\/easycodingschool.com\/blog\/wp-json\/wp\/v2\/posts\/2110\/revisions\/2112"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/easycodingschool.com\/blog\/wp-json\/wp\/v2\/media\/2111"}],"wp:attachment":[{"href":"https:\/\/easycodingschool.com\/blog\/wp-json\/wp\/v2\/media?parent=2110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/easycodingschool.com\/blog\/wp-json\/wp\/v2\/categories?post=2110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/easycodingschool.com\/blog\/wp-json\/wp\/v2\/tags?post=2110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}