diff --git a/packages/shared/jsconfig.node.json b/packages/shared/jsconfig.node.json new file mode 100644 index 0000000000..c9a3832f00 --- /dev/null +++ b/packages/shared/jsconfig.node.json @@ -0,0 +1,28 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "compilerOptions": { + "allowJs": true, + "checkJs": true, + "noEmit": true, + // ES2025 is the earliest that supports our API uses: https://node.green/#ES2025 + // But TS doesn't implement it yet: https://github.com/microsoft/TypeScript/issues/61735 + "target": "ESNext", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "types": ["node"], + "lib": ["ESNext"], + "noLib": false, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "skipLibCheck": true, + "skipDefaultLibCheck": true, + "incremental": true + }, + "compileOnSave": false, + "exclude": [ + "node_modules", + "built", + "coverage", + "**/*.ts" + ] +} diff --git a/packages/shared/jsconfig.web.json b/packages/shared/jsconfig.web.json new file mode 100644 index 0000000000..3e17a5adfb --- /dev/null +++ b/packages/shared/jsconfig.web.json @@ -0,0 +1,26 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "compilerOptions": { + "allowJs": true, + "checkJs": true, + "noEmit": true, + "target": "ES2022", + "module": "ES2022", + "moduleResolution": "Bundler", + "types": [], + "lib": ["ES2022", "DOM", "DOM.Iterable"], + "noLib": false, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "skipLibCheck": true, + "skipDefaultLibCheck": true, + "incremental": true + }, + "compileOnSave": false, + "exclude": [ + "node_modules", + "built", + "coverage", + "**/*.ts" + ] +} diff --git a/packages/shared/jsconfig.webworker.json b/packages/shared/jsconfig.webworker.json new file mode 100644 index 0000000000..68c1def539 --- /dev/null +++ b/packages/shared/jsconfig.webworker.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "extends": "./jsconfig.web.json", + "compilerOptions": { + "lib": [ + "ES2022", + "WebWorker", + "Webworker.Iterable" + ] + } +} diff --git a/packages/shared/package.json b/packages/shared/package.json index 15ea788f45..8ce9e6679b 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -2,5 +2,6 @@ "type": "module", "devDependencies": { "@misskey-dev/eslint-plugin": "2.1.0", + "typescript": "5.9.2" } } diff --git a/packages/shared/tsconfig.node.json b/packages/shared/tsconfig.node.json new file mode 100644 index 0000000000..9183af505d --- /dev/null +++ b/packages/shared/tsconfig.node.json @@ -0,0 +1,42 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "compilerOptions": { + "allowJs": true, + "checkJs": true, + "noEmitOnError": true, + // ES2025 is the earliest that supports our API uses: https://node.green/#ES2025 + // But TS doesn't implement it yet: https://github.com/microsoft/TypeScript/issues/61735 + "target": "ESNext", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "types": ["node"], + "lib": ["ESNext"], + "noLib": false, + "noImplicitAny": true, + "noImplicitReturns": true, + "noUnusedParameters": false, + "noUnusedLocals": false, + "noFallthroughCasesInSwitch": true, + "declaration": false, + "sourceMap": false, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "strict": true, + "strictNullChecks": true, + "strictPropertyInitialization": false, + "skipLibCheck": true, + "skipDefaultLibCheck": true, + "experimentalDecorators": true, + "verbatimModuleSyntax": true, + "emitDecoratorMetadata": true, + "resolveJsonModule": true, + "isolatedModules": true, + "incremental": true + }, + "compileOnSave": false, + "exclude": [ + "node_modules", + "built", + "coverage" + ] +} diff --git a/packages/shared/tsconfig.web.json b/packages/shared/tsconfig.web.json new file mode 100644 index 0000000000..1865ef1c7b --- /dev/null +++ b/packages/shared/tsconfig.web.json @@ -0,0 +1,39 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "compilerOptions": { + "allowJs": true, + "checkJs": true, + "noEmitOnError": false, + // TODO should we support an older standard? + "target": "ES2022", + "module": "ES2022", + "moduleResolution": "Bundler", + "lib": ["ES2022", "DOM", "DOM.Iterable"], + "noLib": false, + "strict": true, + "noImplicitAny": false, + "noImplicitReturns": true, + "noUnusedParameters": false, + "noUnusedLocals": false, + "noFallthroughCasesInSwitch": true, + "declaration": false, + "sourceMap": false, + "strictNullChecks": true, + "experimentalDecorators": true, + "resolveJsonModule": true, + "allowSyntheticDefaultImports": true, + "isolatedModules": true, + "useDefineForClassFields": true, + "esModuleInterop": true, + "verbatimModuleSyntax": true, + "skipLibCheck": true, + "skipDefaultLibCheck": true, + "incremental": true + }, + "compileOnSave": false, + "exclude": [ + "node_modules", + "built", + "coverage" + ] +} diff --git a/packages/shared/tsconfig.webworker.json b/packages/shared/tsconfig.webworker.json new file mode 100644 index 0000000000..cf60dbb9e2 --- /dev/null +++ b/packages/shared/tsconfig.webworker.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "extends": "./tsconfig.web.json", + "compilerOptions": { + "lib": [ + "ES2022", + "WebWorker", + "Webworker.Iterable" + ] + } +}