Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/app-bridge-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"build": "vite build",
"watch": "vite build --watch --mode=development",
"test": "vitest run --passWithNoTests",
"type-check": "tsc -p tsconfig.json --noEmit",
"type-check": "tsc -p tsconfig.json --noEmit && pnpm run type-check:tests",
"type-check:tests": "tsc -p tests && tsc -p tests/tsconfig.react19.json",
"coverage": "vitest run --passWithNoTests --coverage",
"lint": "oxlint -c .eslintrc.json"
},
Expand Down Expand Up @@ -71,6 +72,7 @@
"@shopify/typescript-configs": "catalog:",
"@types/node": "catalog:",
"@types/react": "catalog:",
"@types/react-19": "npm:@types/react@19.2.18",
"@types/react-dom": "catalog:",
"oxlint": "catalog:",
"react": "catalog:",
Expand Down
8 changes: 8 additions & 0 deletions packages/app-bridge-react/tests/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"noEmit": true,
"skipLibCheck": false
},
"include": ["types.test-d.tsx"]
}
11 changes: 11 additions & 0 deletions packages/app-bridge-react/tests/tsconfig.react19.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"baseUrl": "..",
"paths": {
"react": ["node_modules/@types/react-19"],
"react/*": ["node_modules/@types/react-19/*"]
},
"types": []
}
}
40 changes: 40 additions & 0 deletions packages/app-bridge-react/tests/types.test-d.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import {createRef} from 'react';
import type {} from '@shopify/app-bridge-react';

export const elements = (
<>
<ui-modal
id="product-modal"
variant="large"
src="/products"
ref={createRef<UIModalElement>()}
/>
<ui-nav-menu ref={createRef<UINavMenuElement>()} />
<ui-save-bar
id="product-save-bar"
discardConfirmation
ref={createRef<UISaveBarElement>()}
/>
<ui-title-bar title="Products" ref={createRef<UITitleBarElement>()} />
</>
);

// @ts-expect-error Unknown attributes should not be accepted.
export const modalWithUnknownAttribute = <ui-modal unknownAttribute />;
// @ts-expect-error Unknown attributes should not be accepted.
export const navMenuWithUnknownAttribute = <ui-nav-menu unknownAttribute />;
// @ts-expect-error Unknown attributes should not be accepted.
export const saveBarWithUnknownAttribute = <ui-save-bar unknownAttribute />;
// @ts-expect-error Unknown attributes should not be accepted.
export const titleBarWithUnknownAttribute = <ui-title-bar unknownAttribute />;

const wrongRef = createRef<{notAnAppBridgeElement: true}>();

// @ts-expect-error The ref should point to a UIModalElement.
export const modalWithWrongRef = <ui-modal ref={wrongRef} />;
// @ts-expect-error The ref should point to a UINavMenuElement.
export const navMenuWithWrongRef = <ui-nav-menu ref={wrongRef} />;
// @ts-expect-error The ref should point to a UISaveBarElement.
export const saveBarWithWrongRef = <ui-save-bar ref={wrongRef} />;
// @ts-expect-error The ref should point to a UITitleBarElement.
export const titleBarWithWrongRef = <ui-title-bar ref={wrongRef} />;
10 changes: 10 additions & 0 deletions pnpm-lock.yaml

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

Loading