diff --git a/SQL.test-d.ts b/SQL.test-d.ts deleted file mode 100644 index 356f66b..0000000 --- a/SQL.test-d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import SQL from '.' -import { glue, map, SqlStatement } from '.' -import { expectType, expectError } from 'tsd' - -expectType(SQL`SELECT 1`) -expectType(SQL`SELECT 1`) -expectType(SQL`SELECT `.append(SQL`1`)) -expectType(SQL`SELECT `.append(SQL`1`)) -expectType(glue([SQL`SELECT`, SQL`1`], ' ')) -expectType(SQL.glue([SQL`SELECT`, SQL`1`], ' ')) -expectType(SQL.map([1,2,3])) -expectType(SQL.map([1,2,3], x => x**2)) -expectType(map([1,2,3])) -expectType(map([1,2,3], x => x**2)) -expectType(SQL`SELECT 1`.debug) -expectType(SQL`SELECT 1`.sql) -expectType(SQL`SELECT 1`.text) -expectType<{ value: string }>(SQL.unsafe('string')) -expectType<{ value: number }>(SQL.unsafe(1)) -expectType<{ value: string }>(SQL.quoteIdent('string')) -expectError(SQL`SELECT `.append(`1`)) diff --git a/SQL.tst.ts b/SQL.tst.ts new file mode 100644 index 0000000..fa5e474 --- /dev/null +++ b/SQL.tst.ts @@ -0,0 +1,21 @@ +import SQL from '.' +import { glue, map, SqlStatement } from '.' +import { expect } from 'tstyche' + +expect(SQL`SELECT 1`).type.toBe() +expect(SQL`SELECT 1`).type.toBe() +expect(SQL`SELECT `.append(SQL`1`)).type.toBe() +expect(SQL`SELECT `.append(SQL`1`)).type.toBe() +expect(glue([SQL`SELECT`, SQL`1`], ' ')).type.toBe() +expect(SQL.glue([SQL`SELECT`, SQL`1`], ' ')).type.toBe() +expect(SQL.map([1, 2, 3])).type.toBe() +expect(SQL.map([1, 2, 3], x => x ** 2)).type.toBe() +expect(map([1, 2, 3])).type.toBe() +expect(map([1, 2, 3], x => x ** 2)).type.toBe() +expect(SQL`SELECT 1`.debug).type.toBe() +expect(SQL`SELECT 1`.sql).type.toBe() +expect(SQL`SELECT 1`.text).type.toBe() +expect(SQL.unsafe('string')).type.toBe<{ value: string }>() +expect(SQL.unsafe(1)).type.toBe<{ value: number }>() +expect(SQL.quoteIdent('string')).type.toBe<{ value: string }>() +expect(SQL`SELECT `.append).type.not.toBeCallableWith(`1`) diff --git a/package.json b/package.json index a087e8f..7ab1dd7 100644 --- a/package.json +++ b/package.json @@ -6,9 +6,9 @@ "types": "./SQL.d.ts", "scripts": { "test": "node --test *.test.js", - "posttest": "tsd", + "posttest": "tstyche", "test:security": "node ./sqlmap/sqlmap.js", - "test:typescript": "tsd", + "test:typescript": "tstyche", "pretest:security": "git clone --depth=1 https://github.com/sqlmapproject/sqlmap node_modules/sqlmap && node ./sqlmap/db-init.js", "lint": "standard", "benchmark": "node benchmark/index.js" @@ -32,7 +32,7 @@ "pg": "^8.20.0", "sql-template-strings": "^2.2.2", "standard": "^17.1.2", - "tsd": "^0.33.0" + "tstyche": "^7.1.0" }, "standard": { "ignore": [