-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2065 from NullVoxPopuli/type-tests
v3: Maximize compatibility
- Loading branch information
Showing
25 changed files
with
268 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* global QUnit */ | ||
import install from './install'; | ||
import install from './install.js'; | ||
|
||
export { setup } from './qunit-dom-modules'; | ||
export { setup } from './qunit-dom-modules.js'; | ||
|
||
install(QUnit.assert); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "type-tests-resolution-node", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"lint": "tsc --noEmit", | ||
"start": "tsc --noEmit --watch", | ||
"test": "echo 'run pnpm lint' instead" | ||
}, | ||
"devDependencies": { | ||
"@types/qunit": "2.19.6", | ||
"expect-type": "^0.17.3", | ||
"typescript": "5.2.2" | ||
}, | ||
"volta": { | ||
"extends": "../../package.json" | ||
}, | ||
"dependencies": { | ||
"qunit": "^2.20.0", | ||
"qunit-dom": "workspace:*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import QUnit from 'qunit'; | ||
import { setup } from 'qunit-dom'; | ||
import { expectTypeOf } from 'expect-type' | ||
|
||
setup(QUnit.assert); | ||
|
||
expectTypeOf(QUnit.assert.dom).parameter(0).toEqualTypeOf<string | Element | null | undefined>(); | ||
// @ts-expect-error - there is only one parameter | ||
expectTypeOf(QUnit.assert.dom).parameter(1).toEqualTypeOf<never>(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"compilerOptions": { | ||
// Settings needed for test | ||
"target": "esnext", | ||
// using qunit-dom with node would require jsdom or happydom | ||
// but these use cases are currently untested. | ||
// But some older packagers set up TS this way because they | ||
// haven't moved to the newer "bundler" resolution mode yet. | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"allowSyntheticDefaultImports": true, | ||
|
||
///////////////////////// | ||
// Settings to help us type check effectively. | ||
// Unrelated to the above. | ||
|
||
// Strictness settings (one day default?) | ||
"strict": true, | ||
|
||
// Don't implicitly pull in declarations from `@types` packages unless we | ||
// actually import from them AND the package in question doesn't bring its | ||
// own types. | ||
"types": [] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "type-tests-resolution-node16", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"lint": "tsc --noEmit", | ||
"start": "tsc --noEmit --watch", | ||
"test": "echo 'run pnpm lint' instead" | ||
}, | ||
"devDependencies": { | ||
"@types/qunit": "2.19.6", | ||
"expect-type": "^0.17.3", | ||
"typescript": "5.2.2" | ||
}, | ||
"volta": { | ||
"extends": "../../package.json" | ||
}, | ||
"dependencies": { | ||
"qunit": "^2.20.0", | ||
"qunit-dom": "workspace:*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import QUnit from 'qunit'; | ||
import { setup } from 'qunit-dom'; | ||
import { expectTypeOf } from 'expect-type' | ||
|
||
setup(QUnit.assert); | ||
|
||
expectTypeOf(QUnit.assert.dom).parameter(0).toEqualTypeOf<string | Element | null | undefined>(); | ||
// @ts-expect-error - there is only one parameter | ||
expectTypeOf(QUnit.assert.dom).parameter(1).toEqualTypeOf<never>(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"compilerOptions": { | ||
// Settings needed for test | ||
"target": "esnext", | ||
// using qunit-dom with node would require jsdom or happydom | ||
// but these use cases are currently untested. | ||
// Node16+ requires file extensions | ||
"module": "Node16", | ||
"moduleResolution": "node16", | ||
|
||
///////////////////////// | ||
// Settings to help us type check effectively. | ||
// Unrelated to the above. | ||
|
||
// Strictness settings (one day default?) | ||
"strict": true, | ||
|
||
// Don't implicitly pull in declarations from `@types` packages unless we | ||
// actually import from them AND the package in question doesn't bring its | ||
// own types. | ||
"types": [] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "type-tests", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"lint": "tsc --noEmit", | ||
"start": "tsc --noEmit --watch", | ||
"test": "echo 'run pnpm lint' instead" | ||
}, | ||
"devDependencies": { | ||
"@types/qunit": "2.19.6", | ||
"expect-type": "^0.17.3", | ||
"typescript": "5.2.2" | ||
}, | ||
"volta": { | ||
"extends": "../../package.json" | ||
}, | ||
"dependencies": { | ||
"qunit": "^2.20.0", | ||
"qunit-dom": "workspace:*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import QUnit from 'qunit'; | ||
import { setup } from 'qunit-dom'; | ||
import { expectTypeOf } from 'expect-type' | ||
|
||
setup(QUnit.assert); | ||
|
||
expectTypeOf(QUnit.assert.dom).parameter(0).toEqualTypeOf<string | Element | null | undefined>(); | ||
// @ts-expect-error - there is only one parameter | ||
expectTypeOf(QUnit.assert.dom).parameter(1).toEqualTypeOf<never>(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"compilerOptions": { | ||
// Settings needed for test | ||
"target": "esnext", | ||
"module": "esnext", | ||
"moduleResolution": "bundler", | ||
|
||
///////////////////////// | ||
// Settings to help us type check effectively. | ||
// Unrelated to the above. | ||
|
||
// Strictness settings (one day default?) | ||
"strict": true, | ||
|
||
// Don't implicitly pull in declarations from `@types` packages unless we | ||
// actually import from them AND the package in question doesn't bring its | ||
// own types. | ||
"types": [] | ||
} | ||
} |
Oops, something went wrong.