Skip to content

Commit 70ba573

Browse files
authored
refactor(types): migrate from tsd to tstyche (#100)
1 parent 6ff185a commit 70ba573

3 files changed

Lines changed: 20 additions & 14 deletions

File tree

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"c8": "^11.0.0",
5454
"eslint": "^9.17.0",
5555
"neostandard": "^0.13.0",
56-
"tsd": "^0.33.0"
56+
"tstyche": "^7.0.0"
5757
},
5858
"types": "types/index.d.ts",
5959
"files": [
@@ -69,6 +69,6 @@
6969
"lint:fix": "eslint --fix",
7070
"test": "npm run test:unit && npm run test:typescript",
7171
"test:unit": "c8 --100 node --test",
72-
"test:typescript": "tsd"
72+
"test:typescript": "tstyche"
7373
}
74-
}
74+
}

types/index.test-d.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

types/index.tst.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/// <reference types="node" />
2+
3+
import { type IncomingMessage } from 'node:http'
4+
import { expect } from 'tstyche'
5+
import forwardedESM, { forwarded } from '.'
6+
import * as forwardedVarImport from '.'
7+
8+
expect(forwardedESM({} as IncomingMessage)).type.toBe<string[]>()
9+
expect(forwarded({} as IncomingMessage)).type.toBe<string[]>()
10+
11+
expect(forwardedVarImport.default({} as IncomingMessage)).type.toBe<string[]>()
12+
expect(forwardedVarImport.forwarded({} as IncomingMessage)).type.toBe<
13+
string[]
14+
>()
15+
16+
expect(forwarded).type.not.toBeCallableWith()
17+
expect(forwarded).type.not.toBeCallableWith('10.0.0.1')

0 commit comments

Comments
 (0)