Skip to content

Commit

Permalink
fix: add ignoreDeprecations flag for TS 5.x
Browse files Browse the repository at this point in the history
Related to #8650
  • Loading branch information
dummdidumm committed Jan 25, 2023
1 parent 4df53c7 commit dd5922d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/nervous-bags-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: add `ignoreDeprecations` flag for TS 5.x
12 changes: 11 additions & 1 deletion packages/kit/src/core/sync/write_tsconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ import colors from 'kleur';
import { posixify } from '../../utils/filesystem.js';
import { write_if_changed } from './utils.js';

/** @type {import('typescript')} */
// @ts-ignore
let ts = undefined;
try {
ts = (await import('typescript')).default;
} catch {}

/**
* @param {string} cwd
* @param {string} file
Expand Down Expand Up @@ -123,7 +130,10 @@ export function write_tsconfig(kit, cwd = process.cwd()) {
lib: ['esnext', 'DOM', 'DOM.Iterable'],
moduleResolution: 'node',
module: 'esnext',
target: 'esnext'
target: 'esnext',

// TODO(v2): use the new flag verbatimModuleSyntax instead (requires support by Vite/Esbuild)
ignoreDeprecations: Number(ts.version.split('.')[0]) >= 5 ? '5.0' : undefined
},
include,
exclude
Expand Down

0 comments on commit dd5922d

Please sign in to comment.