bump ts to 4.0, ensure no new type syntax

pull/6770/head
Simon Holthausen 5 years ago
parent 5fb01cce3c
commit 3bd3107434

15
package-lock.json generated

@ -5,6 +5,7 @@
"requires": true,
"packages": {
"": {
"name": "svelte",
"version": "3.43.0",
"license": "MIT",
"devDependencies": {
@ -45,7 +46,7 @@
"sourcemap-codec": "^1.4.8",
"tiny-glob": "^0.2.6",
"tslib": "^2.0.3",
"typescript": "^3.7.5"
"typescript": "~4.0.0"
},
"engines": {
"node": ">= 8"
@ -5543,9 +5544,9 @@
"dev": true
},
"node_modules/typescript": {
"version": "3.7.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz",
"integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==",
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.8.tgz",
"integrity": "sha512-oz1765PN+imfz1MlZzSZPtC/tqcwsCyIYA8L47EkRnRW97ztRk83SzMiWLrnChC0vqoYxSU1fcFUDA5gV/ZiPg==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
@ -10298,9 +10299,9 @@
"dev": true
},
"typescript": {
"version": "3.7.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz",
"integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==",
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.8.tgz",
"integrity": "sha512-oz1765PN+imfz1MlZzSZPtC/tqcwsCyIYA8L47EkRnRW97ztRk83SzMiWLrnChC0vqoYxSU1fcFUDA5gV/ZiPg==",
"dev": true
},
"unbox-primitive": {

@ -83,7 +83,7 @@
"pretest": "npm run build",
"posttest": "agadoo internal/index.mjs",
"prepublishOnly": "node check_publish_env.js && npm run lint && npm test",
"tsd": "tsc -p src/compiler --emitDeclarationOnly && tsc -p src/runtime --emitDeclarationOnly",
"tsd": "tsc -p src/compiler --emitDeclarationOnly && tsc -p src/runtime --emitDeclarationOnly && node ./post-typegen.js",
"lint": "eslint \"{src,test}/**/*.{ts,js}\""
},
"repository": {
@ -140,7 +140,7 @@
"sourcemap-codec": "^1.4.8",
"tiny-glob": "^0.2.6",
"tslib": "^2.0.3",
"typescript": "^3.7.5"
"typescript": "~4.0.0"
},
"nyc": {
"include": [

@ -0,0 +1,14 @@
// Svelte 3 types are generated using TS 3.7 . Using newer type syntax is therefore technically a breaking change.
// `export type` / `import type` was introduced later, and needed now in one of the files.
// Replace `export type` with `export` in the `d.ts` file as it doesn't make a difference in `d.ts` files.
// This keeps backwards-compatibility
const fs = require('fs');
const path = 'types/runtime/index.d.ts';
const content = fs.readFileSync(path, 'utf8');
const replaced = content.replace('export type', 'export');
if (content === replaced) {
throw new Error('types/runtime/index.d.ts changed. Update post-typegen.js')
}
fs.writeFileSync(path, replaced);
Loading…
Cancel
Save