Skip to content

Commit accfc15

Browse files
committed
Ban ts-pattern normal import
1 parent 27e81b2 commit accfc15

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

scripts/build/common.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,5 +334,6 @@ export const commonRendererPlugins = [
334334
banImportPlugin(builtinModuleRegex, "Cannot import node inbuilt modules in browser code. You need to use a native.ts file"),
335335
banImportPlugin(/^react$/, "Cannot import from react. React and hooks should be imported from @webpack/common"),
336336
banImportPlugin(/^electron(\/.*)?$/, "Cannot import electron in browser code. You need to use a native.ts file"),
337+
banImportPlugin(/^ts-pattern$/, "Cannot import from ts-pattern. match and P should be imported from @webpack/common"),
337338
...commonOpts.plugins
338339
];

src/plugins/permissionsViewer/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ function MenuItem(guildId: string, id?: string, type?: MenuItemParentType) {
7373
action={() => {
7474
const guild = GuildStore.getGuild(guildId);
7575

76-
const { permissions, header }: { permissions: RoleOrUserPermission[], header: string; } = match(type)
76+
const { permissions, header } = match(type)
77+
.returnType<{ permissions: RoleOrUserPermission[], header: string; }>()
7778
.with(MenuItemParentType.User, () => {
7879
const member = GuildMemberStore.getMember(guildId, id!);
7980

0 commit comments

Comments
 (0)