diff --git a/integration-tests/src/reporter/reportGenerator.ts b/integration-tests/src/reporter/reportGenerator.ts index c46c655b94d7..21f5b0b3f4bb 100644 --- a/integration-tests/src/reporter/reportGenerator.ts +++ b/integration-tests/src/reporter/reportGenerator.ts @@ -170,6 +170,8 @@ function tabToSpace(text: string, tabWidth = 4): string { return result; } -export const __testing__ = { +export const __testing__: { + padLines: typeof padLines; +} = { padLines, }; diff --git a/integration-tests/src/repositoryHelper.ts b/integration-tests/src/repositoryHelper.ts index 05c386a83fb9..2222ec469247 100644 --- a/integration-tests/src/repositoryHelper.ts +++ b/integration-tests/src/repositoryHelper.ts @@ -15,7 +15,7 @@ import type { Logger } from './types.js'; const __dirname = fileURLToPath(new URL('.', import.meta.url)); -export const repositoryDir = Path.resolve(Path.join(__dirname, '../repositories/temp')); +export const repositoryDir: string = Path.resolve(Path.join(__dirname, '../repositories/temp')); function mkdirp(p: string) { return fs.promises.mkdir(p, { recursive: true }); diff --git a/integration-tests/src/snapshots.ts b/integration-tests/src/snapshots.ts index 06f1e1cbb6bf..cca5b86ae6bb 100644 --- a/integration-tests/src/snapshots.ts +++ b/integration-tests/src/snapshots.ts @@ -10,7 +10,7 @@ import type { Repository } from './configDef.js'; const __dirname = fileURLToPath(new URL('.', import.meta.url)); -export const snapshotDir = Path.resolve(Path.join(__dirname, '..', 'snapshots')); +export const snapshotDir: string = Path.resolve(Path.join(__dirname, '..', 'snapshots')); const snapshotFileName = 'snapshot.txt'; const reportFileName = 'report.yaml'; diff --git a/package.json b/package.json index d7c08ac1a2d1..390c75b81902 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^12.1.2", "@swc-node/register": "^1.10.10", - "@tsconfig/node18": "^18.2.4", + "@tsconfig/node20": "^20.1.5", "@types/node": "^20.19.0", "@vitest/coverage-istanbul": "~3.2.2", "conventional-changelog-conventionalcommits": "^9.0.0", diff --git a/packages/cspell-bundled-dicts/.gitignore b/packages/cspell-bundled-dicts/.gitignore index df8442de85db..20a88ec5c2ab 100644 --- a/packages/cspell-bundled-dicts/.gitignore +++ b/packages/cspell-bundled-dicts/.gitignore @@ -1 +1,4 @@ # Things to ignore. + +*.d.ts +*.map diff --git a/packages/cspell-bundled-dicts/tsconfig.json b/packages/cspell-bundled-dicts/tsconfig.json index b5ae3e81f707..b4025bc75fac 100644 --- a/packages/cspell-bundled-dicts/tsconfig.json +++ b/packages/cspell-bundled-dicts/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.esm.json", "compilerOptions": { "declaration": false, + "isolatedDeclarations": false, "declarationMap": false, "sourceMap": false }, diff --git a/packages/cspell-config-lib/tsconfig.json b/packages/cspell-config-lib/tsconfig.json index 89f72354670e..1b3bb91f043b 100644 --- a/packages/cspell-config-lib/tsconfig.json +++ b/packages/cspell-config-lib/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "../../tsconfig.esm.json", "compilerOptions": { + "isolatedDeclarations": false, // make this true "types": ["node"], "outDir": "dist" }, diff --git a/packages/cspell-dictionary/src/SpellingDictionary/CachingDictionary.ts b/packages/cspell-dictionary/src/SpellingDictionary/CachingDictionary.ts index 11e481698d1d..efb02ff34ad6 100644 --- a/packages/cspell-dictionary/src/SpellingDictionary/CachingDictionary.ts +++ b/packages/cspell-dictionary/src/SpellingDictionary/CachingDictionary.ts @@ -122,7 +122,7 @@ export function createCachingDictionary( return cached; } -export function enableLogging(enabled = !logRequests): void { +export function enableLogging(enabled: boolean = !logRequests): void { logRequests = enabled; } diff --git a/packages/cspell-dictionary/src/SpellingDictionary/SpellingDictionaryCollection.ts b/packages/cspell-dictionary/src/SpellingDictionary/SpellingDictionaryCollection.ts index b38841be7272..e1c07f02edd2 100644 --- a/packages/cspell-dictionary/src/SpellingDictionary/SpellingDictionaryCollection.ts +++ b/packages/cspell-dictionary/src/SpellingDictionary/SpellingDictionaryCollection.ts @@ -174,7 +174,10 @@ export function isSpellingDictionaryCollection(dict: SpellingDictionary): dict i return dict instanceof SpellingDictionaryCollectionImpl; } -export const __testing__ = { +export const __testing__: { + isWordInAnyDictionary: typeof isWordInAnyDictionary; + isWordForbiddenInAnyDictionary: typeof isWordForbiddenInAnyDictionary; +} = { isWordInAnyDictionary, isWordForbiddenInAnyDictionary, }; diff --git a/packages/cspell-dictionary/src/SpellingDictionary/SpellingDictionaryFromTrie.ts b/packages/cspell-dictionary/src/SpellingDictionary/SpellingDictionaryFromTrie.ts index 8c4bfa431e2c..262ac4096441 100644 --- a/packages/cspell-dictionary/src/SpellingDictionary/SpellingDictionaryFromTrie.ts +++ b/packages/cspell-dictionary/src/SpellingDictionary/SpellingDictionaryFromTrie.ts @@ -29,8 +29,8 @@ import type { SuggestOptions } from './SuggestOptions.js'; export class SpellingDictionaryFromTrie implements SpellingDictionary { private _size = 0; - readonly knownWords = new Set(); - readonly unknownWords = new Set(); + readonly knownWords: Set = new Set(); + readonly unknownWords: Set = new Set(); readonly mapWord: (word: string) => string; readonly remapWord: (word: string) => string[]; readonly type = 'SpellingDictionaryFromTrie'; @@ -254,4 +254,6 @@ function* outerWordForms(word: string, mapWord: (word: string) => string[]): Ite return; } -export const __testing__ = { outerWordForms }; +export const __testing__: { + outerWordForms: typeof outerWordForms; +} = { outerWordForms }; diff --git a/packages/cspell-dictionary/src/SpellingDictionary/SpellingDictionaryMethods.ts b/packages/cspell-dictionary/src/SpellingDictionary/SpellingDictionaryMethods.ts index a939441c6a03..1566277e38cb 100644 --- a/packages/cspell-dictionary/src/SpellingDictionary/SpellingDictionaryMethods.ts +++ b/packages/cspell-dictionary/src/SpellingDictionary/SpellingDictionaryMethods.ts @@ -98,7 +98,10 @@ export function createWeightMapFromDictionaryInformation(di: DictionaryInformati return di ? mapDictionaryInformationToWeightMap(di) : undefined; } -export const __testMethods__ = { +export const __testMethods__: { + wordSearchForms: typeof wordSearchForms; + wordSearchFormsArray: typeof wordSearchFormsArray; +} = { wordSearchForms, wordSearchFormsArray, }; diff --git a/packages/cspell-dictionary/src/index.ts b/packages/cspell-dictionary/src/index.ts index dcc678c2d9bd..50b6e1e7b0eb 100644 --- a/packages/cspell-dictionary/src/index.ts +++ b/packages/cspell-dictionary/src/index.ts @@ -33,7 +33,10 @@ export { /** * Debugging utilities. */ -export const _debug = { +export const _debug: { + cacheDictionaryEnableLogging: typeof cacheDictionaryEnableLogging; + cacheDictionaryGetLog: typeof cacheDictionaryGetLog; +} = { cacheDictionaryEnableLogging, cacheDictionaryGetLog, }; diff --git a/packages/cspell-dictionary/src/util/AutoCache.ts b/packages/cspell-dictionary/src/util/AutoCache.ts index 090c28954b76..13eee8d2b764 100644 --- a/packages/cspell-dictionary/src/util/AutoCache.ts +++ b/packages/cspell-dictionary/src/util/AutoCache.ts @@ -68,7 +68,7 @@ export function createCache01(size: number): Cache01 { return new Cache01Map(size); } -export function autoCache(fn: (p: string) => R, size = CACHE_SIZE): AutoCache { +export function autoCache(fn: (p: string) => R, size: number = CACHE_SIZE): AutoCache { const cache = createCache01(size); const ac: AutoCache = get as AutoCache; diff --git a/packages/cspell-dictionary/src/util/AutoResolve.ts b/packages/cspell-dictionary/src/util/AutoResolve.ts index c23d249c8930..6fe0e5a73e55 100644 --- a/packages/cspell-dictionary/src/util/AutoResolve.ts +++ b/packages/cspell-dictionary/src/util/AutoResolve.ts @@ -7,7 +7,7 @@ export function autoResolve(map: Map, key: K, resolve: (k: K) => V): } export class AutoResolveCache { - readonly map = new Map(); + readonly map: Map = new Map(); get(k: K): V | undefined; get(k: K, resolve: (k: K) => V): V; @@ -39,7 +39,7 @@ export function autoResolveWeak(map: WeakMap, key: K, } export class AutoResolveWeakCache { - readonly map = new WeakMap(); + readonly map: WeakMap = new WeakMap(); get(k: K): V | undefined; get(k: K, resolve: (k: K) => V): V; diff --git a/packages/cspell-dictionary/src/util/repMap.ts b/packages/cspell-dictionary/src/util/repMap.ts index 991af3379790..fa3a2459984c 100644 --- a/packages/cspell-dictionary/src/util/repMap.ts +++ b/packages/cspell-dictionary/src/util/repMap.ts @@ -183,7 +183,13 @@ function addToTrie(node: RepTrieNode, match: string, replaceWith: string) { node.rep = [...s]; } -export const __testing__ = { +export const __testing__: { + charsetToRepMap: typeof charsetToRepMapRegEx; + createMapperRegExp: typeof createMapperRegExp; + createTrie: typeof createTrie; + calcAllEdits: typeof calcAllEdits; + applyEdits: typeof applyEdits; +} = { charsetToRepMap: charsetToRepMapRegEx, createMapperRegExp, createTrie, diff --git a/packages/cspell-dictionary/src/util/simpleCache.ts b/packages/cspell-dictionary/src/util/simpleCache.ts index 57349e60e1b6..3f256eaf5fb0 100644 --- a/packages/cspell-dictionary/src/util/simpleCache.ts +++ b/packages/cspell-dictionary/src/util/simpleCache.ts @@ -27,7 +27,7 @@ export class SimpleWeakCache { return undefined; } - set(key: K, value: T) { + set(key: K, value: T): void { this._set(key, { v: value }); } @@ -110,7 +110,7 @@ export class SimpleCache { return undefined; } - set(key: K, value: T) { + set(key: K, value: T): void { this._set(key, { v: value }); } diff --git a/packages/cspell-eslint-plugin/fixtures/simple/tsconfig.json b/packages/cspell-eslint-plugin/fixtures/simple/tsconfig.json index 6f81f5afdaed..65fe461958eb 100644 --- a/packages/cspell-eslint-plugin/fixtures/simple/tsconfig.json +++ b/packages/cspell-eslint-plugin/fixtures/simple/tsconfig.json @@ -1,7 +1,6 @@ { - "extends": "@tsconfig/node18/tsconfig.json", + "extends": "@tsconfig/node20/tsconfig.json", "compilerOptions": { - "allowJs": true, "rootDir": ".", "outDir": "dist" }, diff --git a/packages/cspell-eslint-plugin/scripts/build-options-schema.mjs b/packages/cspell-eslint-plugin/scripts/build-options-schema.mjs index 5e64357e6464..2722b88f2d27 100755 --- a/packages/cspell-eslint-plugin/scripts/build-options-schema.mjs +++ b/packages/cspell-eslint-plugin/scripts/build-options-schema.mjs @@ -62,7 +62,13 @@ async function run() { await writeFile( new URL(outFileTs, rootUrl), - '// NOTICE: This file is autogenerated.\nexport const optionsSchema = ' + schemaString, + `\ +// NOTICE: This file is autogenerated. + +import type { Rule } from 'eslint'; + +export const optionsSchema: Rule.RuleMetaData['schema'] = ${schemaString}\ +`, ); } diff --git a/packages/cspell-eslint-plugin/src/common/logger.cts b/packages/cspell-eslint-plugin/src/common/logger.cts index cf6c599b530f..813fcb30f7b5 100644 --- a/packages/cspell-eslint-plugin/src/common/logger.cts +++ b/packages/cspell-eslint-plugin/src/common/logger.cts @@ -14,6 +14,8 @@ export interface LoggerOptions { useAsync?: boolean; } +type Log = (...p: Parameters) => void; + export class Logger { readonly logFile: string; readonly cwd: string; @@ -39,7 +41,7 @@ export class Logger { : fs.appendFileSync(this.logFile, message); } - log = this._log.bind(this); + log: Log = this._log.bind(this); } let logger: Logger | undefined; diff --git a/packages/cspell-eslint-plugin/src/generated/schema.cts b/packages/cspell-eslint-plugin/src/generated/schema.cts index 7223495471e9..ef5bbcf25e6f 100644 --- a/packages/cspell-eslint-plugin/src/generated/schema.cts +++ b/packages/cspell-eslint-plugin/src/generated/schema.cts @@ -1,5 +1,8 @@ // NOTICE: This file is autogenerated. -export const optionsSchema = { + +import type { Rule } from 'eslint'; + +export const optionsSchema: Rule.RuleMetaData['schema'] = { "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "definitions": {}, diff --git a/packages/cspell-eslint-plugin/src/plugin/cspell-eslint-plugin.cts b/packages/cspell-eslint-plugin/src/plugin/cspell-eslint-plugin.cts index 7e8400a72d38..c327afeb8f75 100644 --- a/packages/cspell-eslint-plugin/src/plugin/cspell-eslint-plugin.cts +++ b/packages/cspell-eslint-plugin/src/plugin/cspell-eslint-plugin.cts @@ -179,4 +179,4 @@ export const configs: ESlintPlugin['configs'] = { 'recommended-legacy': recommended, }; -export const plugin = { rules, configs, meta } satisfies ESlintPlugin; +export const plugin: ESlintPlugin = { rules, configs, meta } satisfies ESlintPlugin; diff --git a/packages/cspell-eslint-plugin/src/plugin/recommended.cts b/packages/cspell-eslint-plugin/src/plugin/recommended.cts index 97b1421aa965..11a992467c10 100644 --- a/packages/cspell-eslint-plugin/src/plugin/recommended.cts +++ b/packages/cspell-eslint-plugin/src/plugin/recommended.cts @@ -11,5 +11,5 @@ const config: Linter.Config = { }, }; -export const plugins = config.plugins; -export const rules = config.rules; +export const plugins: Linter.Config['plugins'] = config.plugins; +export const rules: Linter.Config['rules'] = config.rules; diff --git a/packages/cspell-eslint-plugin/src/spellCheckAST/walkTree.cts b/packages/cspell-eslint-plugin/src/spellCheckAST/walkTree.cts index a086350c194a..9289f5b36b7c 100644 --- a/packages/cspell-eslint-plugin/src/spellCheckAST/walkTree.cts +++ b/packages/cspell-eslint-plugin/src/spellCheckAST/walkTree.cts @@ -6,7 +6,7 @@ import type { ASTPath, ASTPathElement, Key } from './ASTPath.js' with { 'resolut const debugMode = false; -export function walkTree(node: ASTNode, enter: (path: ASTPath) => void) { +export function walkTree(node: ASTNode, enter: (path: ASTPath) => void): void { const visited = new Set(); let pathNode: ASTPath | undefined = undefined; diff --git a/packages/cspell-filetypes/src/filetypes.ts b/packages/cspell-filetypes/src/filetypes.ts index 97c199d45726..9d902d7b019a 100644 --- a/packages/cspell-filetypes/src/filetypes.ts +++ b/packages/cspell-filetypes/src/filetypes.ts @@ -6,9 +6,9 @@ type ExtensionToFileTypeIdMap = Map; const binaryFormatIds = definitions.filter((d) => d.format === 'Binary').map((d) => d.id); -export const binaryLanguages = new Set(['binary', 'image', 'video', 'fonts', ...binaryFormatIds]); +export const binaryLanguages: Set = new Set(['binary', 'image', 'video', 'fonts', ...binaryFormatIds]); -export const generatedFiles = new Set([ +export const generatedFiles: Set = new Set([ ...binaryLanguages, 'map', 'lock', diff --git a/packages/cspell-gitignore/src/GitIgnoreFile.ts b/packages/cspell-gitignore/src/GitIgnoreFile.ts index b88ef0cc6316..d947d3e0472f 100644 --- a/packages/cspell-gitignore/src/GitIgnoreFile.ts +++ b/packages/cspell-gitignore/src/GitIgnoreFile.ts @@ -149,6 +149,8 @@ function globToString(glob: GlobPatternWithRoot, relativeToDir: string | URL): s return (base ? base + '/' : '') + glob.glob; } -export const __testing__ = { +export const __testing__: { + mustBeHierarchical: typeof mustBeHierarchical; +} = { mustBeHierarchical, }; diff --git a/packages/cspell-gitignore/src/helpers.ts b/packages/cspell-gitignore/src/helpers.ts index ff195e522da0..902ee5d66168 100644 --- a/packages/cspell-gitignore/src/helpers.ts +++ b/packages/cspell-gitignore/src/helpers.ts @@ -130,7 +130,7 @@ const defaultHelper = factoryPathHelper(path); * @returns root directory * @deprecated to be removed in the next major version. */ -export const directoryRoot = defaultHelper.directoryRoot; +export const directoryRoot: (directory: string) => string = defaultHelper.directoryRoot; /** * Checks to see if the child directory is nested under the parent directory. @@ -139,7 +139,7 @@ export const directoryRoot = defaultHelper.directoryRoot; * @returns true iff child is a child of parent. * @deprecated to be removed in the next major version. */ -export const isParentOf = defaultHelper.isParentOf; +export const isParentOf: (parent: string, child: string) => boolean = defaultHelper.isParentOf; /** * Check to see if a parent directory contains a child directory. @@ -148,7 +148,7 @@ export const isParentOf = defaultHelper.isParentOf; * @returns true iff child is the same as the parent or nested in the parent. * @deprecated to be removed in the next major version. */ -export const contains = defaultHelper.contains; +export const contains: (parent: string, child: string) => boolean = defaultHelper.contains; /** * Make a path relative to another if the other is a parent. @@ -157,7 +157,7 @@ export const contains = defaultHelper.contains; * @returns the normalized relative path or undefined if rootPath is not a parent. * @deprecated to be removed in the next major version. */ -export const makeRelativeTo = defaultHelper.makeRelativeTo; +export const makeRelativeTo: (path: string, rootPath: string) => string | undefined = defaultHelper.makeRelativeTo; /** * Normalize a path to have only forward slashes. @@ -165,7 +165,7 @@ export const makeRelativeTo = defaultHelper.makeRelativeTo; * @returns a normalized string. * @deprecated to be removed in the next major version. */ -export const normalizePath = defaultHelper.normalizePath; +export const normalizePath: (path: string) => string = defaultHelper.normalizePath; export const DefaultPathHelper: PathHelper = { directoryRoot, diff --git a/packages/cspell-glob/tsconfig.json b/packages/cspell-glob/tsconfig.json index 30891b89672c..4285e1c25b7e 100644 --- a/packages/cspell-glob/tsconfig.json +++ b/packages/cspell-glob/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "../../tsconfig.esm.json", "compilerOptions": { + "isolatedDeclarations": false, // make this true "rootDir": "src", "outDir": "dist", "types": ["node"] diff --git a/packages/cspell-grammar/package.json b/packages/cspell-grammar/package.json index b5637b83c49e..a78acb37b822 100644 --- a/packages/cspell-grammar/package.json +++ b/packages/cspell-grammar/package.json @@ -66,12 +66,12 @@ ], "scripts": { "clean": "shx rm -rf dist temp coverage \"*.tsbuildInfo\"", - "build": "tsc -b . -f", + "build": "tsc -p .", "clean-build": "pnpm run clean && pnpm run build", "coverage": "vitest run --coverage", "test:watch": "vitest", "test": "vitest run", - "watch": "tsc -b . -w -f" + "watch": "tsc -p . -w" }, "repository": { "type": "git", diff --git a/packages/cspell-grammar/tsconfig.esm.json b/packages/cspell-grammar/tsconfig.esm.json deleted file mode 100644 index 54835c32c5c8..000000000000 --- a/packages/cspell-grammar/tsconfig.esm.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "../../tsconfig.esm.json", - "compilerOptions": { - "composite": true, - "tsBuildInfoFile": "dist/compile.esm.tsbuildInfo", - "rootDir": "src", - "outDir": "dist", - "types": ["node"] - }, - "include": ["src"] -} diff --git a/packages/cspell-grammar/tsconfig.json b/packages/cspell-grammar/tsconfig.json index 635469e894c2..4285e1c25b7e 100644 --- a/packages/cspell-grammar/tsconfig.json +++ b/packages/cspell-grammar/tsconfig.json @@ -1,4 +1,10 @@ { - "files": [], - "references": [{ "path": "./tsconfig.esm.json" }] + "extends": "../../tsconfig.esm.json", + "compilerOptions": { + "isolatedDeclarations": false, // make this true + "rootDir": "src", + "outDir": "dist", + "types": ["node"] + }, + "include": ["src"] } diff --git a/packages/cspell-lib/tsconfig.json b/packages/cspell-lib/tsconfig.json index 30891b89672c..4285e1c25b7e 100644 --- a/packages/cspell-lib/tsconfig.json +++ b/packages/cspell-lib/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "../../tsconfig.esm.json", "compilerOptions": { + "isolatedDeclarations": false, // make this true "rootDir": "src", "outDir": "dist", "types": ["node"] diff --git a/packages/cspell-pipe/tsconfig.json b/packages/cspell-pipe/tsconfig.json index a8f3aeb00246..174baffc7365 100644 --- a/packages/cspell-pipe/tsconfig.json +++ b/packages/cspell-pipe/tsconfig.json @@ -2,6 +2,7 @@ "$schema": "https://json.schemastore.org/tsconfig", "extends": "../../tsconfig.esm.json", "compilerOptions": { + "isolatedDeclarations": false, // make this true "rootDir": "src", "outDir": "dist", "types": ["node"] diff --git a/packages/cspell-tools/tsconfig.json b/packages/cspell-tools/tsconfig.json index 5d3fa446c62e..a6a1f470c0db 100644 --- a/packages/cspell-tools/tsconfig.json +++ b/packages/cspell-tools/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig.esm.json", "compilerOptions": { - "exactOptionalPropertyTypes": false, // make this true + "declaration": true, + "isolatedDeclarations": false, "types": ["node"], "outDir": "dist" }, diff --git a/packages/cspell/tsconfig.json b/packages/cspell/tsconfig.json index 5d6f73157382..c42b8964cb12 100644 --- a/packages/cspell/tsconfig.json +++ b/packages/cspell/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "../../tsconfig.esm.json", "compilerOptions": { + "isolatedDeclarations": false, // make this true "rootDir": "src/app", "outDir": "dist/esm", "target": "es2022", diff --git a/packages/dynamic-import/src/test/helper.ts b/packages/dynamic-import/src/test/helper.ts index 260db9240e97..d1d40ce88333 100644 --- a/packages/dynamic-import/src/test/helper.ts +++ b/packages/dynamic-import/src/test/helper.ts @@ -14,7 +14,7 @@ async function callHello(file: string | URL, paths?: string | URL | (string | UR return (await dynamicImport(file, paths)).sayHello('Bob.'); } -export function test() { +export function test(): Promise { return Promise.all([ callHello(pathToFileURL('./fixtures/hello_world.mjs')), callHello(path.resolve('./fixtures/hello_world.mjs')), diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 76fbbeae2ba2..187b1b28bdc2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -47,9 +47,9 @@ importers: '@swc-node/register': specifier: ^1.10.10 version: 1.10.10(@swc/core@1.7.26)(@swc/types@0.1.12)(typescript@5.8.3) - '@tsconfig/node18': - specifier: ^18.2.4 - version: 18.2.4 + '@tsconfig/node20': + specifier: ^20.1.5 + version: 20.1.5 '@types/node': specifier: ^20.19.0 version: 20.19.0 @@ -4176,8 +4176,8 @@ packages: '@tsconfig/node16@1.0.4': resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} - '@tsconfig/node18@18.2.4': - resolution: {integrity: sha512-5xxU8vVs9/FNcvm3gE07fPbn9tl6tqGGWA9tSlwsUEkBxtRnTsNmwrV8gasZ9F/EobaSv9+nu8AxUKccw77JpQ==} + '@tsconfig/node20@20.1.5': + resolution: {integrity: sha512-Vm8e3WxDTqMGPU4GATF9keQAIy1Drd7bPwlgzKJnZtoOsTm1tduUTbDjg0W5qERvGuxPI2h9RbMufH0YdfBylA==} '@tufjs/canonical-json@2.0.0': resolution: {integrity: sha512-yVtV8zsdo8qFHe+/3kw81dSLyF7D576A5cCFCi4X7B39tWT7SekaEFUnvnWJHz+9qO7qJTah1JbrDjWKqFtdWA==} @@ -14728,7 +14728,7 @@ snapshots: '@tsconfig/node16@1.0.4': {} - '@tsconfig/node18@18.2.4': {} + '@tsconfig/node20@20.1.5': {} '@tufjs/canonical-json@2.0.0': {} diff --git a/rfc/drafts/cspell-extensions/tsconfig.json b/rfc/drafts/cspell-extensions/tsconfig.json index 080cf2ff110d..9169a91fbfcd 100644 --- a/rfc/drafts/cspell-extensions/tsconfig.json +++ b/rfc/drafts/cspell-extensions/tsconfig.json @@ -1,6 +1,6 @@ { "$schema": "https://json.schemastore.org/tsconfig", - "extends": "@tsconfig/node18/tsconfig.json", + "extends": "@tsconfig/node20/tsconfig.json", "compilerOptions": { "outDir": "dist" }, diff --git a/rfc/rfc-0001 suggestions/src/config-definitions.ts b/rfc/rfc-0001 suggestions/src/config-definitions.ts index c49872b7a9f2..b784c79a9bcb 100644 --- a/rfc/rfc-0001 suggestions/src/config-definitions.ts +++ b/rfc/rfc-0001 suggestions/src/config-definitions.ts @@ -69,7 +69,11 @@ const exampleTerms: Terms = { /*********************/ -export const __testing__ = { +export const __testing__: { + exampleDef: DictionaryDefinitionSuggestions; + exampleFlagWords: NewBaseSettings; + exampleTerms: Terms; +} = { exampleDef, exampleFlagWords, exampleTerms, diff --git a/test-packages/cspell-dictionary/test-cspell-dictionary/tsconfig.json b/test-packages/cspell-dictionary/test-cspell-dictionary/tsconfig.json index 104cfab402ee..31e1107ed780 100644 --- a/test-packages/cspell-dictionary/test-cspell-dictionary/tsconfig.json +++ b/test-packages/cspell-dictionary/test-cspell-dictionary/tsconfig.json @@ -5,6 +5,7 @@ "moduleResolution": "NodeNext", "composite": true, "tsBuildInfoFile": "dist/compile.esm.tsbuildInfo", + "isolatedDeclarations": false, "rootDir": "src", "outDir": "dist/esm", "types": ["node"] diff --git a/test-packages/cspell-gitignore/test-cspell-gitignore/tsconfig.json b/test-packages/cspell-gitignore/test-cspell-gitignore/tsconfig.json index 104cfab402ee..31e1107ed780 100644 --- a/test-packages/cspell-gitignore/test-cspell-gitignore/tsconfig.json +++ b/test-packages/cspell-gitignore/test-cspell-gitignore/tsconfig.json @@ -5,6 +5,7 @@ "moduleResolution": "NodeNext", "composite": true, "tsBuildInfoFile": "dist/compile.esm.tsbuildInfo", + "isolatedDeclarations": false, "rootDir": "src", "outDir": "dist/esm", "types": ["node"] diff --git a/test-packages/cspell-glob/test-cspell-glob/src/index.ts b/test-packages/cspell-glob/test-cspell-glob/src/index.ts index 0c98a8fb8b28..6730e2911b2f 100644 --- a/test-packages/cspell-glob/test-cspell-glob/src/index.ts +++ b/test-packages/cspell-glob/test-cspell-glob/src/index.ts @@ -2,6 +2,6 @@ import { resolve } from 'node:path'; import * as glob from 'cspell-glob'; -export function run(filename: string) { +export function run(filename: string): string { return glob.fileOrGlobToGlob(filename, resolve('.')).glob; } diff --git a/test-packages/cspell-io/test-cspell-io/src/index.ts b/test-packages/cspell-io/test-cspell-io/src/index.ts index 910be247b672..772b5d544f16 100644 --- a/test-packages/cspell-io/test-cspell-io/src/index.ts +++ b/test-packages/cspell-io/test-cspell-io/src/index.ts @@ -1,6 +1,6 @@ import { readFileText } from 'cspell-io'; -export function run(file: string) { +export function run(file: string): Promise { return read(file); } diff --git a/test-packages/cspell-lib/test-cspell-esbuild-cjs/source/src/index.ts b/test-packages/cspell-lib/test-cspell-esbuild-cjs/source/src/index.ts index 72927d7d22cb..34f793956ae7 100644 --- a/test-packages/cspell-lib/test-cspell-esbuild-cjs/source/src/index.ts +++ b/test-packages/cspell-lib/test-cspell-esbuild-cjs/source/src/index.ts @@ -26,7 +26,7 @@ async function checkFile(filename: string) { return result.issues; } -export async function run() { +export async function run(): Promise { console.log(`Start: ${new Date().toISOString()}`); const r = await checkSpelling('These are my coztom wordz.'); console.log(`End: ${new Date().toISOString()}`); diff --git a/test-packages/cspell-lib/test-cspell-esbuild-cjs/source/tsconfig.json b/test-packages/cspell-lib/test-cspell-esbuild-cjs/source/tsconfig.json index 820a931c2d8e..b2de342a5336 100644 --- a/test-packages/cspell-lib/test-cspell-esbuild-cjs/source/tsconfig.json +++ b/test-packages/cspell-lib/test-cspell-esbuild-cjs/source/tsconfig.json @@ -1,8 +1,7 @@ { "extends": "../../../../tsconfig.esm.json", "compilerOptions": { - "outDir": "dist", - "allowJs": true + "outDir": "dist" }, "include": ["src"] } diff --git a/test-packages/cspell-lib/test-cspell-lib-esm/src/index.ts b/test-packages/cspell-lib/test-cspell-lib-esm/src/index.ts index a375aee39790..88a8da310def 100644 --- a/test-packages/cspell-lib/test-cspell-lib-esm/src/index.ts +++ b/test-packages/cspell-lib/test-cspell-lib-esm/src/index.ts @@ -14,7 +14,7 @@ async function checkSpelling(phrase: string) { return result.issues; } -export async function run() { +export async function run(): Promise { console.log(`Start: ${new Date().toISOString()}`); const r = await checkSpelling('These are my coztom wordz.'); console.log(`End: ${new Date().toISOString()}`); diff --git a/test-packages/cspell-lib/test-cspell-lib-esm/tsconfig.json b/test-packages/cspell-lib/test-cspell-lib-esm/tsconfig.json index c1be12d6b38f..1e61513b1328 100644 --- a/test-packages/cspell-lib/test-cspell-lib-esm/tsconfig.json +++ b/test-packages/cspell-lib/test-cspell-lib-esm/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "../../../tsconfig.esm.json", "compilerOptions": { + "isolatedDeclarations": false, "outDir": "dist" }, "include": ["src"] diff --git a/test-packages/cspell-lib/test-cspell-lib-rollup/plugin/tsconfig.json b/test-packages/cspell-lib/test-cspell-lib-rollup/plugin/tsconfig.json index 820a931c2d8e..b2de342a5336 100644 --- a/test-packages/cspell-lib/test-cspell-lib-rollup/plugin/tsconfig.json +++ b/test-packages/cspell-lib/test-cspell-lib-rollup/plugin/tsconfig.json @@ -1,8 +1,7 @@ { "extends": "../../../../tsconfig.esm.json", "compilerOptions": { - "outDir": "dist", - "allowJs": true + "outDir": "dist" }, "include": ["src"] } diff --git a/test-packages/cspell-lib/test-cspell-lib-rollup/src/index.ts b/test-packages/cspell-lib/test-cspell-lib-rollup/src/index.ts index a375aee39790..88a8da310def 100644 --- a/test-packages/cspell-lib/test-cspell-lib-rollup/src/index.ts +++ b/test-packages/cspell-lib/test-cspell-lib-rollup/src/index.ts @@ -14,7 +14,7 @@ async function checkSpelling(phrase: string) { return result.issues; } -export async function run() { +export async function run(): Promise { console.log(`Start: ${new Date().toISOString()}`); const r = await checkSpelling('These are my coztom wordz.'); console.log(`End: ${new Date().toISOString()}`); diff --git a/test-packages/cspell-lib/test-cspell-lib-rollup/tsconfig.json b/test-packages/cspell-lib/test-cspell-lib-rollup/tsconfig.json index 86731d264737..c1be12d6b38f 100644 --- a/test-packages/cspell-lib/test-cspell-lib-rollup/tsconfig.json +++ b/test-packages/cspell-lib/test-cspell-lib-rollup/tsconfig.json @@ -1,8 +1,7 @@ { "extends": "../../../tsconfig.esm.json", "compilerOptions": { - "outDir": "dist", - "allowJs": true + "outDir": "dist" }, "include": ["src"] } diff --git a/test-packages/cspell-lib/test-cspell-lib-tsup/tsconfig.json b/test-packages/cspell-lib/test-cspell-lib-tsup/tsconfig.json index 36b906dba3d7..92cd071c6af5 100644 --- a/test-packages/cspell-lib/test-cspell-lib-tsup/tsconfig.json +++ b/test-packages/cspell-lib/test-cspell-lib-tsup/tsconfig.json @@ -2,8 +2,7 @@ "extends": "../../../tsconfig.esm.json", "compilerOptions": { "noEmit": true, - "outDir": "dist", - "allowJs": true + "outDir": "dist" }, "include": ["src"] } diff --git a/test-packages/cspell-service-bus/test-cspell-service-bus-esm/src/index.mts b/test-packages/cspell-service-bus/test-cspell-service-bus-esm/src/index.mts index 77db1e118338..fe7bcabd8cb2 100644 --- a/test-packages/cspell-service-bus/test-cspell-service-bus-esm/src/index.mts +++ b/test-packages/cspell-service-bus/test-cspell-service-bus-esm/src/index.mts @@ -4,6 +4,7 @@ import { assert } from 'node:console'; import type { Dispatcher, Handler, + RequestFactory, ServiceBus, ServiceRequest, ServiceRequestFactoryRequestType, @@ -34,15 +35,23 @@ function calcFib(request: FibRequest): ServiceResponse { } const TypeRequestFib = 'Computations:calc-fib' as const; -export const FibRequestFactory = requestFactory( - TypeRequestFib, -); +export const FibRequestFactory: RequestFactory< + 'Computations:calc-fib', + { + readonly fib: number; + }, + number +> = requestFactory(TypeRequestFib); type FibRequestFactory = typeof FibRequestFactory; type FibRequest = ServiceRequestFactoryRequestType; -export const StringLengthRequestFactory = requestFactory<'calc-string-length', { readonly str: string }, number>( +export const StringLengthRequestFactory: RequestFactory< 'calc-string-length', -); + { + readonly str: string; + }, + number +> = requestFactory<'calc-string-length', { readonly str: string }, number>('calc-string-length'); export class StringToUpperRequest extends ServiceRequestCls<'toUpper', { readonly str: string }, string> { constructor(readonly str: string) { diff --git a/test-packages/cspell-trie-lib/test-cspell-trie-lib/src/index.ts b/test-packages/cspell-trie-lib/test-cspell-trie-lib/src/index.ts index 8e29e6df6ee3..82879cc74213 100644 --- a/test-packages/cspell-trie-lib/test-cspell-trie-lib/src/index.ts +++ b/test-packages/cspell-trie-lib/test-cspell-trie-lib/src/index.ts @@ -10,7 +10,7 @@ three return parseDictionary(words); } -export function run() { +export function run(): boolean { const dict = createDictionary(); return dict.has('two'); } diff --git a/test-packages/cspell-trie-lib/test-cspell-trie-lib/tsconfig.json b/test-packages/cspell-trie-lib/test-cspell-trie-lib/tsconfig.json index 4fe38af2e39f..478e28cd1ae8 100644 --- a/test-packages/cspell-trie-lib/test-cspell-trie-lib/tsconfig.json +++ b/test-packages/cspell-trie-lib/test-cspell-trie-lib/tsconfig.json @@ -3,6 +3,7 @@ "compilerOptions": { "module": "NodeNext", "moduleResolution": "NodeNext", + "isolatedDeclarations": false, "rootDir": "src", "outDir": "dist/esm", "types": ["node"] diff --git a/test-packages/cspell/test-cspell-esbuild-cjs/source/src/index.ts b/test-packages/cspell/test-cspell-esbuild-cjs/source/src/index.ts index a83ca5e87e41..2f25e4dc0c7c 100644 --- a/test-packages/cspell/test-cspell-esbuild-cjs/source/src/index.ts +++ b/test-packages/cspell/test-cspell-esbuild-cjs/source/src/index.ts @@ -7,7 +7,7 @@ async function checkFile(fileGlob: string) { return result; } -export async function run() { +export async function run(): Promise { const fileGlob = process.argv[2]; assert(fileGlob, 'File to check expected.'); diff --git a/test-packages/cspell/test-cspell-esbuild-cjs/source/tsconfig.json b/test-packages/cspell/test-cspell-esbuild-cjs/source/tsconfig.json index 820a931c2d8e..b2de342a5336 100644 --- a/test-packages/cspell/test-cspell-esbuild-cjs/source/tsconfig.json +++ b/test-packages/cspell/test-cspell-esbuild-cjs/source/tsconfig.json @@ -1,8 +1,7 @@ { "extends": "../../../../tsconfig.esm.json", "compilerOptions": { - "outDir": "dist", - "allowJs": true + "outDir": "dist" }, "include": ["src"] } diff --git a/test-packages/examples/example-cspell-lib-single-doc/src/index.ts b/test-packages/examples/example-cspell-lib-single-doc/src/index.ts index 6ec606e5bb43..9d9f5de570bb 100644 --- a/test-packages/examples/example-cspell-lib-single-doc/src/index.ts +++ b/test-packages/examples/example-cspell-lib-single-doc/src/index.ts @@ -2,7 +2,7 @@ import * as path from 'node:path'; import { spellCheckDocument } from 'cspell-lib'; -export async function run() { +export async function run(): Promise { const app = path.relative(process.cwd(), process.argv[1]); const file = process.argv[2]; diff --git a/tsconfig.base.json b/tsconfig.base.json index 9e042a604646..0cb2e7000640 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1,13 +1,14 @@ { "$schema": "https://json.schemastore.org/tsconfig", "display": "CSpell Monorepo Base Config", - "extends": "@tsconfig/node18/tsconfig.json", + "extends": "@tsconfig/node20/tsconfig.json", "compilerOptions": { "alwaysStrict": true, "declaration": true, "declarationMap": true, "esModuleInterop": true, "exactOptionalPropertyTypes": true, + "isolatedDeclarations": true, "moduleResolution": "node16", "newLine": "LF", "noImplicitAny": true, diff --git a/tsconfig.esm.json b/tsconfig.esm.json index a4713ead8a12..6430c15403e7 100644 --- a/tsconfig.esm.json +++ b/tsconfig.esm.json @@ -3,7 +3,7 @@ "extends": "./tsconfig.next.json", "compilerOptions": { "skipLibCheck": true, - "module": "Node16", + "module": "node18", "moduleResolution": "Node16" }, "include": ["src"]