You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running `npx tsd-check` as a command will verify that the type definition works correctly.
35
+
Running `npx tsd` as a command will verify that the type definition works correctly.
36
36
37
37
Let's add some extra [assertions](#assertions). We can assert the return type of our function call to match a certain type.
38
38
39
39
```ts
40
-
import {expectType} from'tsd-check';
40
+
import {expectType} from'tsd';
41
41
importconcatfrom'.';
42
42
43
43
expectType<string>(concat('foo', 'bar'));
44
44
expectType<string>(concat(1, 2));
45
45
```
46
46
47
-
The `tsd-check` command will succeed again.
47
+
The `tsd` command will succeed again.
48
48
49
49
We change our implementation and type definition to return a `number` when both inputs are of type `number`.
50
50
@@ -57,7 +57,7 @@ declare const concat: {
57
57
exportdefaultconcat;
58
58
```
59
59
60
-
If we don't change the test file and we run the `tsd-check` command again, the test will fail.
60
+
If we don't change the test file and we run the `tsd` command again, the test will fail.
61
61
62
62
<imgsrc="screenshot.png"width="1330">
63
63
@@ -66,7 +66,7 @@ If we don't change the test file and we run the `tsd-check` command again, the t
66
66
If your method returns a `Promise`, you can use top-level `await` to resolve the value instead of wrapping it in an `async`[IIFE](https://developer.mozilla.org/en-US/docs/Glossary/IIFE).
@@ -83,7 +83,7 @@ When you have spread your tests over multiple files, you can store all those fil
83
83
```json
84
84
{
85
85
"name": "my-module",
86
-
"tsd-check": {
86
+
"tsd": {
87
87
"directory": "my-test-dir"
88
88
}
89
89
}
@@ -93,7 +93,7 @@ Now you can put all your test files in the `my-test-dir` directory.
93
93
94
94
### Custom TypeScript config
95
95
96
-
By default, `tsd-check` applies the following configuration:
96
+
By default, `tsd` applies the following configuration:
97
97
98
98
```json5
99
99
{
@@ -106,14 +106,14 @@ By default, `tsd-check` applies the following configuration:
106
106
}
107
107
```
108
108
109
-
If you wish to override these options, you have the possibility to provide a custom TypeScript config to `tsd-check` by specifying it in `package.json`.
109
+
If you wish to override these options, you have the possibility to provide a custom TypeScript config to `tsd` by specifying it in `package.json`.
110
110
111
111
*Default options will still apply if you don't override them explicitly.* You can't override the `moduleResolution` and `skipLibCheck` options.
0 commit comments