mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
build: Properly add typecheck tests (#10722)
* build: exclude type tests from running * refactor: use `tsc` * test: fix broker test * test: fix voice test * test: fix builders test * test: use vitest typecheck remove unused test scripts skip lib check rm vitest.d.ts * fix: remove tsd from core and ws * fix: extend local tsconfig --------- Co-authored-by: almeidx <github@almeidx.dev> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { expectType } from 'tsd';
|
||||
import { expectTypeOf } from 'vitest';
|
||||
import { isEquatable, type Equatable } from '../../src/index.js';
|
||||
|
||||
declare const unknownObj: unknown;
|
||||
|
||||
if (isEquatable(unknownObj)) {
|
||||
expectType<Equatable<unknown>>(unknownObj);
|
||||
expectType<boolean>(unknownObj.equals(unknownObj));
|
||||
expectTypeOf(unknownObj).toEqualTypeOf<Equatable<unknown>>();
|
||||
expectTypeOf(unknownObj.equals(unknownObj)).toEqualTypeOf<boolean>();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { expectType } from 'tsd';
|
||||
import { expectTypeOf } from 'vitest';
|
||||
import { isJSONEncodable, type JSONEncodable } from '../../src/index.js';
|
||||
|
||||
declare const unknownObj: unknown;
|
||||
|
||||
if (isJSONEncodable(unknownObj)) {
|
||||
expectType<JSONEncodable<unknown>>(unknownObj);
|
||||
expectType<unknown>(unknownObj.toJSON());
|
||||
expectTypeOf(unknownObj).toEqualTypeOf<JSONEncodable<unknown>>();
|
||||
expectTypeOf(unknownObj.toJSON()).toEqualTypeOf<unknown>();
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"scripts": {
|
||||
"build": "tsc --noEmit && tsup",
|
||||
"build:docs": "tsc -p tsconfig.docs.json",
|
||||
"test": "vitest run && tsd",
|
||||
"test": "vitest run --config ../../vitest.config.ts",
|
||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
|
||||
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
|
||||
"fmt": "pnpm run format",
|
||||
@@ -73,7 +73,6 @@
|
||||
"eslint-config-neon": "^0.1.62",
|
||||
"eslint-formatter-pretty": "^6.0.1",
|
||||
"prettier": "^3.4.2",
|
||||
"tsd": "^0.31.2",
|
||||
"tsup": "^8.3.5",
|
||||
"turbo": "^2.3.3",
|
||||
"typescript": "~5.5.4",
|
||||
@@ -85,8 +84,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"provenance": true
|
||||
},
|
||||
"tsd": {
|
||||
"directory": "__tests__/types"
|
||||
}
|
||||
}
|
||||
|
||||
10
packages/util/tsconfig.test.json
Normal file
10
packages/util/tsconfig.test.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig.json",
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": ["__tests__/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
Reference in New Issue
Block a user