Skip to content

Commit

Permalink
fix: remove tsd from core and ws
Browse files Browse the repository at this point in the history
  • Loading branch information
almeidx committed Jan 24, 2025
1 parent 5dffaba commit c29fe5e
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 29 deletions.
18 changes: 10 additions & 8 deletions packages/core/__tests__/types.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,19 @@ describe('Interaction with_response overloads.', () => {
});

test('Launch activity returns undefined.', () => {
assertType<Promise<undefined>>(api.interactions.launchActivity(SNOWFLAKE, TOKEN, { with_response: false }));
assertType<Promise<undefined>>(api.interactions.launchActivity(SNOWFLAKE, TOKEN));
expectTypeOf(api.interactions.launchActivity(SNOWFLAKE, TOKEN, { with_response: false })).toEqualTypeOf<
Promise<undefined>
>();
expectTypeOf(api.interactions.launchActivity(SNOWFLAKE, TOKEN)).toEqualTypeOf<Promise<undefined>>();
});

test('Launch activity returns RESTPostAPIInteractionCallbackWithResponseResult.', () =>
assertType<Promise<RESTPostAPIInteractionCallbackWithResponseResult>>(
api.interactions.launchActivity(SNOWFLAKE, TOKEN, { with_response: true }),
));
expectTypeOf(api.interactions.launchActivity(SNOWFLAKE, TOKEN, { with_response: true })).toEqualTypeOf<
Promise<RESTPostAPIInteractionCallbackWithResponseResult>
>());

test('Launch activity returns either RESTPostAPIInteractionCallbackWithResponseResult or undefined.', () =>
assertType<Promise<RESTPostAPIInteractionCallbackWithResponseResult | undefined>>(
api.interactions.launchActivity(SNOWFLAKE, TOKEN, { with_response: boolValue }),
));
expectTypeOf(api.interactions.launchActivity(SNOWFLAKE, TOKEN, { with_response: boolValue })).toEqualTypeOf<
Promise<RESTPostAPIInteractionCallbackWithResponseResult | undefined>
>());
});
4 changes: 0 additions & 4 deletions packages/util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -85,8 +84,5 @@
"publishConfig": {
"access": "public",
"provenance": true
},
"tsd": {
"directory": "__tests__/types"
}
}
6 changes: 3 additions & 3 deletions packages/ws/__tests__/types/WebSocketManager.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { AsyncEventEmitter } from '@vladfrangu/async_event_emitter';
import { expectType, expectAssignable } from 'tsd';
import { expectTypeOf } from 'vitest';
import type { ManagerShardEventsMap, WebSocketShardEventsMap, WebSocketManager } from '../../src/index.js';

declare const manager: WebSocketManager;
Expand All @@ -9,5 +9,5 @@ type AugmentedShardEventsMap = {
[K in keyof WebSocketShardEventsMap]: [...WebSocketShardEventsMap[K], shardId: number];
};

expectType<AugmentedShardEventsMap>(eventMap);
expectAssignable<AsyncEventEmitter<AugmentedShardEventsMap>>(manager);
expectTypeOf(eventMap).toEqualTypeOf<AugmentedShardEventsMap>();
expectTypeOf(manager).toMatchTypeOf<AsyncEventEmitter<AugmentedShardEventsMap>>();
1 change: 0 additions & 1 deletion packages/ws/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
"eslint-formatter-pretty": "^6.0.1",
"mock-socket": "^9.3.1",
"prettier": "^3.4.2",
"tsd": "^0.31.2",
"tsup": "^8.3.5",
"turbo": "^2.3.3",
"typescript": "~5.5.4",
Expand Down
144 changes: 131 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c29fe5e

Please sign in to comment.