xgqfrms / vscode

:cn: :rocket: Visual Studio Code & VSCode Code Snippets All in One 🎉
https://vscode.xgqfrms.xyz
MIT License
3 stars 1 forks source link

vscode & TypeScript & allowImportingTsExtensions #67

Open xgqfrms opened 1 year ago

xgqfrms commented 1 year ago

vscode & TypeScript & allowImportingTsExtensions

???

allowImportingTsExtensions

module "/Users/xgqfrms-mm/Documents/github/leetcode/js-solutions/large-dataset"

An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled.ts(5097)
image
{
  "compilerOptions": {
    // "target": "ES2022",
    // "target": "ES2020",
    "target": "ESNext",
    // "module": "NodeNext",
    "module": "ESNext",
    "lib": [
      "ES2015",
      "ES2016",
      "ES2017",
      "ES2018",
      "ES2019",
      "ES2020",
      // "ES2021",
      // "ES2022",
      "ESNext",
      "dom",
      "dom.iterable"
    ],
    "downlevelIteration": false,
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "sourceMap": true,
    "sourceRoot": "./src",
    "allowJs": true,
    // Generate d.ts files ✅
    "declaration": true,
    "checkJs": false,
    "noImplicitAny": false,
    "baseUrl": "./src",
    "locale": "zh-CN",
    "noImplicitReturns": true,
    // "allowImportingTsExtensions": true,
    // error TS5023: Unknown compiler option 'allowImportingTsExtensions'. ❌
    // "noEmit": true,
    // Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set.ts
    "incremental": false
  },
  "type": "module",
  "include": [
    // include folder ✅
    "src/**/*",
    "js-solutions/**/*",
    "test/**/*"
  ],
  "exclude": [
    "node_modules",
    "build",
    "js-solutions/**/*",
    "data-structures/**/*",
    "000-xyz/**/*",
    "test/**/*.spec.ts"
  ]
}

https://github.com/microsoft/TypeScript/pull/52230

https://github.com/microsoft/TypeScript/issues/52320

xgqfrms commented 1 year ago

https://devblogs.microsoft.com/typescript/announcing-typescript-5-0-beta/

xgqfrms commented 1 year ago

https://twitter.com/robpalmer2/status/1602787257810829312

image