Skip to content

Commit

Permalink
Run TypeScript on the types (#1042)
Browse files Browse the repository at this point in the history
Co-authored-by: ehmicky <ehmicky@gmail.com>
  • Loading branch information
sindresorhus and ehmicky committed May 10, 2024
1 parent ab2a9ed commit e2903e9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"node": ">=18"
},
"scripts": {
"test": "xo && c8 ava && tsd"
"test": "xo && c8 ava && tsd && tsc"
},
"files": [
"index.js",
Expand Down Expand Up @@ -72,6 +72,7 @@
"path-key": "^4.0.0",
"tempfile": "^5.0.0",
"tsd": "^0.31.0",
"typescript": "^5.4.5",
"which": "^4.0.0",
"xo": "^0.58.0"
},
Expand Down
4 changes: 2 additions & 2 deletions test-d/return/result-main.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ expectType<[]>(unicornsResultSync.pipedFrom);

const error = new Error('.');
if (error instanceof ExecaError) {
expectAssignable<ExecaError>(error);
expectType<ExecaError<any>>(error);
expectType<'ExecaError'>(error.name);
expectType<string>(error.message);
expectType<number | undefined>(error.exitCode);
Expand All @@ -75,7 +75,7 @@ if (error instanceof ExecaError) {

const errorSync = new Error('.');
if (errorSync instanceof ExecaSyncError) {
expectAssignable<ExecaSyncError>(errorSync);
expectType<ExecaSyncError<any>>(errorSync);
expectType<'ExecaSyncError'>(errorSync.name);
expectType<string>(errorSync.message);
expectType<number | undefined>(errorSync.exitCode);
Expand Down
11 changes: 11 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"module": "nodenext",
"moduleResolution": "nodenext",
"target": "ES2022",
"strict": true
},
"files": [
"index.d.ts"
]
}

0 comments on commit e2903e9

Please sign in to comment.