compileOptions - target & lib

Seulyi Yoo·2022년 7월 15일
0

TypeScript

목록 보기
29/42
post-thumbnail
{
	"target": {
    "description": "Set the JavaScript language version for emitted JavaScript and include compatible library declarations.",
    "type": "string",
    "default": "ES3",
    "anyOf": [
      {
        "enum": [
          "ES3",
          "ES5",
          "ES6",
          "ES2015",
          "ES2016",
          "ES2017",
          "ES2018",
          "ES2019",
          "ES2020",
          "ES2021",
          "ES2022",
          "ESNext"
        ]
      },
      {
        "pattern": "^([Ee][Ss]([356]|(20(1[56789]|2[012]))|[Nn][Ee][Xx][Tt]))$"
      }
    ],
    "markdownDescription": "Set the JavaScript language version for emitted JavaScript and include compatible library declarations.\n\nSee more: https://www.typescriptlang.org/tsconfig#target"
  },
{
"lib": {
	      "description": "Specify a set of bundled library declaration files that describe the target runtime environment.",
	      "type": "array",
	      "uniqueItems": true,
	      "items": {
	        "type": "string",
	        "anyOf": [
	          {
	            "enum": [
	              "ES5",
	              "ES6",
	              "ES2015",
	              "ES2015.Collection",
	              "ES2015.Core",
	              "ES2015.Generator",
	              "ES2015.Iterable",
	              "ES2015.Promise",
	              "ES2015.Proxy",
	              "ES2015.Reflect",
	              "ES2015.Symbol.WellKnown",
	              "ES2015.Symbol",
	              "ES2016",
	              "ES2016.Array.Include",
	              "ES2017",
	              "ES2017.Intl",
	              "ES2017.Object",
	              "ES2017.SharedMemory",
	              "ES2017.String",
	              "ES2017.TypedArrays",
	              "ES2018",
	              "ES2018.AsyncGenerator",
	              "ES2018.AsyncIterable",
	              "ES2018.Intl",
	              "ES2018.Promise",
	              "ES2018.Regexp",
	              "ES2019",
	              "ES2019.Array",
	              "ES2019.Object",
	              "ES2019.String",
	              "ES2019.Symbol",
	              "ES2020",
	              "ES2020.BigInt",
	              "ES2020.Promise",
	              "ES2020.String",
	              "ES2020.Symbol.WellKnown",
	              "ESNext",
	              "ESNext.Array",
	              "ESNext.AsyncIterable",
	              "ESNext.BigInt",
	              "ESNext.Intl",
	              "ESNext.Promise",
	              "ESNext.String",
	              "ESNext.Symbol",
	              "DOM",
	              "DOM.Iterable",
	              "ScriptHost",
	              "WebWorker",
	              "WebWorker.ImportScripts",
	              "Webworker.Iterable",
	              "ES7",
	              "ES2021",
	              "ES2020.SharedMemory",
	              "ES2020.Intl",
	              "ES2021.Promise",
	              "ES2021.String",
	              "ES2021.WeakRef",
	              "ESNext.WeakRef",
	              "es2021.intl",
	              "ES2022",
	              "ES2022.Array",
	              "ES2022.Error",
	              "ES2022.Intl",
	              "ES2022.Object",
	              "ES2022.String"
	            ]
	          },
	          {
	            "pattern": "^[Ee][Ss]5|[Ee][Ss]6|[Ee][Ss]7$"
	          },
	          {
	            "pattern": "^[Ee][Ss]2015(\\.([Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Cc][Oo][Rr][Ee]|[Gg][Ee][Nn][Ee][Rr][Aa][Tt][Oo][Rr]|[Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Pp][Rr][Oo][Xx][Yy]|[Rr][Ee][Ff][Ll][Ee][Cc][Tt]|[Ss][Yy][Mm][Bb][Oo][Ll].[Ww][Ee][Ll][Ll][Kk][Nn][Oo][Ww][Nn]|[Ss][Yy][Mm][Bb][Oo][Ll]))?$"
	          },
	          {
	            "pattern": "^[Ee][Ss]2016(\\.[Aa][Rr][Rr][Aa][Yy].[Ii][Nn][Cc][Ll][Uu][Dd][Ee])?$"
	          },
	          {
	            "pattern": "^[Ee][Ss]2017(\\.([Ii][Nn][Tt][Ll]|[Oo][Bb][Jj][Ee][Cc][Tt]|[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy]|[Ss][Tt][Rr][Ii][Nn][Gg]|[Tt][Yy][Pp][Ee][Dd][Aa][Rr][Rr][Aa][Yy][Ss]))?$"
	          },
	          {
	            "pattern": "^[Ee][Ss]2018(\\.([Aa][Ss][Yy][Nn][Cc][Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ii][Nn][Tt][Ll]|[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Rr][Ee][Gg][Ee][Xx][Pp]))?$"
	          },
	          {
	            "pattern": "^[Ee][Ss]2019(\\.([Aa][Rr][Rr][Aa][Yy]|[Oo][Bb][Jj][Ee][Cc][Tt]|[Ss][Tt][Rr][Ii][Nn][Gg]|[Ss][Yy][Mm][Bb][Oo][Ll]))?$"
	          },
	          {
	            "pattern": "^[Ee][Ss]2020(\\.([Bb][Ii][Gg][Ii][Nn][Tt]|[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ss][Tt][Rr][Ii][Nn][Gg]|[Ss][Yy][Mm][Bb][Oo][Ll].[Ww][Ee][Ll][Ll][Kk][Nn][Oo][Ww][Nn]))?$"
	          },
	          {
	            "pattern": "^[Ee][Ss]2021(\\.([Ii][Nn][Tt][Ll]|[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ss][Tt][Rr][Ii][Nn][Gg]|[Ww][Ee][Aa][Kk][Rr][Ee][Ff]))?$"
	          },
	          {
	            "pattern": "^[Ee][Ss]2022(\\.([Aa][Rr][Rr][Aa][Yy]|[Ee][Rr][Rr][Oo][Rr]|[Ii][Nn][Tt][Ll]|[Oo][Bb][Jj][Ee][Cc][Tt]|[Ss][Tt][Rr][Ii][Nn][Gg]))?$"
	          },
	          {
	            "pattern": "^[Ee][Ss][Nn][Ee][Xx][Tt](\\.([Aa][Rr][Rr][Aa][Yy]|[Aa][Ss][Yy][Nn][Cc][Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Bb][Ii][Gg][Ii][Nn][Tt]|[Ii][Nn][Tt][Ll]|[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ss][Tt][Rr][Ii][Nn][Gg]|[Ss][Yy][Mm][Bb][Oo][Ll]|[Ww][Ee][Aa][Kk][Rr][Ee][Ff]))?$"
	            },
	            {
	              "pattern": "^[Dd][Oo][Mm](\\.[Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee])?$"
	            },
	            {
	              "pattern": "^[Ss][Cc][Rr][Ii][Pp][Tt][Hh][Oo][Ss][Tt]$"
	            },
	            {
	              "pattern": "^[Ww][Ee][Bb][Ww][Oo][Rr][Kk][Ee][Rr](\\.[Ii][Mm][Pp][Oo][Rr][Tt][Ss][Cc][Rr][Ii][Pp][Tt][Ss])?$"
	            }
	          ]
	        },
	        "markdownDescription": "Specify a set of bundled library declaration files that describe the target runtime environment.\n\nSee more: https://www.typescriptlang.org/tsconfig#lib"
	      },
}

target & lib?

  • target
    • 빌드의 결과물을 어떤 버전으로 할 것이냐
    • 지정을 안하면 es3
  • lib
    • 기본 type definition 라이브러리를 어떤 것을 사용할 것이냐
    • lib 를 지정하지 않았을 때,
      • target 이 ‘es3’ 이고, default 로 lib.d.ts 를 사용
      • target 이 ‘es5’ 이면, default 로 dom, es5, scripthost 를 사용
      • target 이 ‘es6’ 이면, default 로 dom, es6, dom.iterable, scripthost 를 사용
    • lib 를 지정하면 그 lib 배열로만 라이브러리를 사용
      • 빈 [ ] ⇒ “no definition found ~~”
profile
성장하는 개발자 유슬이 입니다!

0개의 댓글