Skip to content

Commit

Permalink
chore: test for this in tsd land not ts land
Browse files Browse the repository at this point in the history
  • Loading branch information
vladfrangu committed Jul 20, 2024
1 parent 799044d commit 588140c
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 9 deletions.
4 changes: 2 additions & 2 deletions deno/rest/v10/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ export const Routes = {
applicationEmoji(applicationId: Snowflake, emojiId: Snowflake) {
return `/applications/${applicationId}/emojis/${emojiId}` as const;
},
} satisfies Record<string, (...args: unknown[]) => `/${string}`>;
};

export const StickerPackApplicationId = '710982414301790216';

Expand Down Expand Up @@ -1277,7 +1277,7 @@ export const CDNRoutes = {
) {
return `/guilds/${guildId}/users/${userId}/banners/${guildMemberBanner}.${format}` as const;
},
} satisfies Record<string, (...args: unknown[]) => `/${string}`>;
};

export type DefaultUserAvatarAssets = 0 | 1 | 2 | 3 | 4 | 5;

Expand Down
4 changes: 2 additions & 2 deletions deno/rest/v9/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ export const Routes = {
applicationEmoji(applicationId: Snowflake, emojiId: Snowflake) {
return `/applications/${applicationId}/emojis/${emojiId}` as const;
},
} satisfies Record<string, (...args: unknown[]) => `/${string}`>;
};

export const StickerPackApplicationId = '710982414301790216';

Expand Down Expand Up @@ -1286,7 +1286,7 @@ export const CDNRoutes = {
) {
return `/guilds/${guildId}/users/${userId}/banners/${guildMemberBanner}.${format}` as const;
},
} satisfies Record<string, (...args: unknown[]) => `/${string}`>;
};

export type DefaultUserAvatarAssets = 0 | 1 | 2 | 3 | 4 | 5;

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"prepublishOnly": "run-s clean test:lint build:node",
"test:lint": "prettier --check . && eslint --ext mjs,ts \"{gateway,payloads,rest,rpc,voice,utils}/**/*.ts\" \"{globals,v*}.ts\" \"scripts/**/*.mjs\"",
"pretest:types": "tsc",
"test:types": "tsd -t ./v10.d.ts",
"test:types": "tsd -t ./v10.d.ts && tsd -t ./v9.d.ts",
"posttest:types": "npm run clean:node"
},
"keywords": [
Expand Down
4 changes: 2 additions & 2 deletions rest/v10/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ export const Routes = {
applicationEmoji(applicationId: Snowflake, emojiId: Snowflake) {
return `/applications/${applicationId}/emojis/${emojiId}` as const;
},
} satisfies Record<string, (...args: unknown[]) => `/${string}`>;
};

export const StickerPackApplicationId = '710982414301790216';

Expand Down Expand Up @@ -1277,7 +1277,7 @@ export const CDNRoutes = {
) {
return `/guilds/${guildId}/users/${userId}/banners/${guildMemberBanner}.${format}` as const;
},
} satisfies Record<string, (...args: unknown[]) => `/${string}`>;
};

export type DefaultUserAvatarAssets = 0 | 1 | 2 | 3 | 4 | 5;

Expand Down
4 changes: 2 additions & 2 deletions rest/v9/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ export const Routes = {
applicationEmoji(applicationId: Snowflake, emojiId: Snowflake) {
return `/applications/${applicationId}/emojis/${emojiId}` as const;
},
} satisfies Record<string, (...args: unknown[]) => `/${string}`>;
};

export const StickerPackApplicationId = '710982414301790216';

Expand Down Expand Up @@ -1286,7 +1286,7 @@ export const CDNRoutes = {
) {
return `/guilds/${guildId}/users/${userId}/banners/${guildMemberBanner}.${format}` as const;
},
} satisfies Record<string, (...args: unknown[]) => `/${string}`>;
};

export type DefaultUserAvatarAssets = 0 | 1 | 2 | 3 | 4 | 5;

Expand Down
5 changes: 5 additions & 0 deletions tests/v10/routes.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { expectAssignable } from 'tsd';
import { CDNRoutes, Routes } from '../../rest/v10/index';

expectAssignable<Record<string, (...args: any[]) => `/${string}`>>(Routes);
expectAssignable<Record<string, (...args: any[]) => `/${string}`>>(CDNRoutes);
5 changes: 5 additions & 0 deletions tests/v9/routes.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { expectAssignable } from 'tsd';
import { CDNRoutes, Routes } from '../../rest/v9/index';

expectAssignable<Record<string, (...args: any[]) => `/${string}`>>(Routes);
expectAssignable<Record<string, (...args: any[]) => `/${string}`>>(CDNRoutes);

0 comments on commit 588140c

Please sign in to comment.