Skip to content

Commit ebf2c7b

Browse files
committed
build: migrate deprecated tsconfig options for TypeScript 6
Replace deprecated `baseUrl`, `paths`, and `moduleResolution: "node"` with `rootDir` and `moduleResolution: "bundler"`. Add `external.d.ts` for the untyped `events` module. Made-with: Cursor
1 parent 3cf9b19 commit ebf2c7b

3 files changed

Lines changed: 21 additions & 6 deletions

File tree

external.d.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
declare module 'events' {
2+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3+
type Listener = (...args: any[]) => void;
4+
5+
export default class EventEmitter {
6+
addListener(event: string, listener: Listener): this;
7+
on(event: string, listener: Listener): this;
8+
once(event: string, listener: Listener): this;
9+
removeListener(event: string, listener: Listener): this;
10+
off(event: string, listener: Listener): this;
11+
removeAllListeners(event?: string): this;
12+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
13+
emit(event: string, ...args: any[]): boolean;
14+
listeners(event: string): Listener[];
15+
listenerCount(event: string): number;
16+
}
17+
}

tsconfig.eslint.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"extends": "./tsconfig",
33
"compilerOptions": {
4-
"noEmit": true
4+
"noEmit": true,
5+
"rootDir": "."
56
},
67
"include": ["src", "test", "external.d.ts"],
78
"exclude": ["dist", "es2015", "node_modules"]

tsconfig.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
{
22
"compilerOptions": {
33
"lib": ["es2016", "dom"],
4+
"rootDir": "src",
45
"outDir": "dist",
56
"target": "esNext",
67
"module": "esNext",
7-
"baseUrl": ".",
8-
"paths": {
9-
"*": ["src/*"]
10-
},
118
"esModuleInterop": true,
129
"allowSyntheticDefaultImports": true,
1310
"sourceMap": true,
1411
"allowJs": false,
1512
"checkJs": false,
1613
"skipLibCheck": true,
1714
"jsx": "react-jsx",
18-
"moduleResolution": "node",
15+
"moduleResolution": "bundler",
1916
"forceConsistentCasingInFileNames": true,
2017
"noImplicitReturns": true,
2118
"noImplicitThis": true,

0 commit comments

Comments
 (0)