diff --git a/package.json b/package.json index 2fa6683..e1a2762 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "lint:fix": "eslint --fix", "test": "nyc npm run test:unit && npm run test:typescript", "test:unit": "tape \"test/*.test.js\"", - "test:typescript": "tsd", + "test:typescript": "tstyche", "test:browser": "airtap test/*.test.js" }, "repository": { @@ -69,6 +69,6 @@ "nyc": "^18.0.0", "playwright": "^1.43.1", "tape": "^5.7.5", - "tsd": "^0.33.0" + "tstyche": "^7.1.0" } } diff --git a/types/index.test-d.ts b/types/index.tst.ts similarity index 52% rename from types/index.test-d.ts rename to types/index.tst.ts index c12e348..3c99893 100644 --- a/types/index.test-d.ts +++ b/types/index.tst.ts @@ -1,14 +1,16 @@ -import { expectType, expectError } from 'tsd' +/// + +import { expect } from 'tstyche' import sjson from '..' -expectError(sjson.parse(null)) -expectType(sjson.parse('{"anything":0}')) +expect(sjson.parse).type.not.toBeCallableWith(null) +expect(sjson.parse('{"anything":0}')).type.toBe() sjson.parse('"test"', null, { protoAction: 'remove' }) -expectError(sjson.parse('"test"', null, { protoAction: 'incorrect' })) +expect(sjson.parse).type.not.toBeCallableWith('"test"', null, { protoAction: 'incorrect' }) sjson.parse('"test"', null, { constructorAction: 'ignore' }) -expectError(sjson.parse('"test"', null, { constructorAction: 'incorrect' })) -expectError(sjson.parse('"test"', { constructorAction: 'incorrect' })) +expect(sjson.parse).type.not.toBeCallableWith('"test"', null, { constructorAction: 'incorrect' }) +expect(sjson.parse).type.not.toBeCallableWith('"test"', { constructorAction: 'incorrect' }) sjson.parse('test', { constructorAction: 'remove' }) sjson.parse('test', { protoAction: 'ignore' }) sjson.parse('test', () => {}, { protoAction: 'ignore', constructorAction: 'remove' }) @@ -16,11 +18,11 @@ sjson.parse('"test"', null, { safe: true }) sjson.parse('"test"', { safe: true }) sjson.parse('test', () => {}, { safe: false }) sjson.parse('test', { protoAction: 'remove', safe: true }) -expectError(sjson.parse('"test"', null, { safe: 'incorrect' })) +expect(sjson.parse).type.not.toBeCallableWith('"test"', null, { safe: 'incorrect' }) sjson.safeParse('"test"', null) sjson.safeParse('"test"') -expectError(sjson.safeParse(null)) +expect(sjson.safeParse).type.not.toBeCallableWith(null) sjson.scan({}, { protoAction: 'remove' }) sjson.scan({}, { protoAction: 'ignore' }) @@ -29,15 +31,15 @@ sjson.scan({}, { constructorAction: 'ignore' }) sjson.scan([], {}) sjson.scan({}, { safe: true }) sjson.scan({}, { protoAction: 'remove', safe: false }) -expectError(sjson.scan({}, { safe: 'incorrect' })) +expect(sjson.scan).type.not.toBeCallableWith({}, { safe: 'incorrect' }) declare const input: Buffer sjson.parse(input) sjson.safeParse(input) -sjson.parse('{"anything":0}', (key, value) => { - expectType(key) +sjson.parse('{"anything":0}', (key, _value) => { + expect(key).type.toBe() }) -sjson.safeParse('{"anything":0}', (key, value) => { - expectType(key) +sjson.safeParse('{"anything":0}', (key, _value) => { + expect(key).type.toBe() })