Skip to content

Commit

Permalink
fix type checking job
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Jun 20, 2022
1 parent 15008d6 commit f93e88d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
- run: pnpm types:check
- run: pnpm lint
- run: pnpm build
- run: pnpm test-typing
- run: pnpm test
env:
CI: true
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ dist
.eslintcache
examples/**/yarn.lock
package-lock.json
tsconfig.tsbuildinfo
*/**/*.tsbuildinfo
coverage
*/**/.turbo
.turbo
.rollup.cache
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@
"lint": "eslint . --ext .ts,.tsx --cache",
"lint:fix": "pnpm lint --fix",
"coverage": "jest --coverage",
"test": "tsc --noEmit -p test && jest"
"test-typing": "tsc --noEmit -p test/type/tsconfig.json && tsc --noEmit -p test/tsconfig.json",
"test": "jest"
},
"husky": {
"hooks": {
Expand Down
2 changes: 1 addition & 1 deletion test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
},
"include": [".", "./jest-setup.ts"],
// This file need "strict": true
"exclude": ["./type/mutator.ts"]
"exclude": ["./type"]
}
10 changes: 8 additions & 2 deletions test/type/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@ export function useTestCache() {
}

export function useCustomSWRConfig() {
const noNull = [
// @ts-expect-error
<SWRConfig key={'null'} value={null} />,
// @ts-expect-error
<SWRConfig key={'callback-return-null'} value={() => null} />
]

return (
<>
<SWRConfig value={null} />
{noNull}
<SWRConfig value={undefined} />
<SWRConfig value={() => ({})} />
<SWRConfig value={() => null} />

<SWRConfig
// @ts-expect-error
Expand Down

0 comments on commit f93e88d

Please sign in to comment.