Last active
July 25, 2025 19:03
-
-
Save 43081j/8628fc331362eafdf82ce7933dcb7839 to your computer and use it in GitHub Desktop.
sveltekit type fudgery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function getFoo(): FooType<NonExistentType> | null; | |
| import type { FooType } from './foo.d.ts'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { | |
| NonExistentType | |
| // @ts-ignore | |
| } from "$nonExistent"; | |
| export interface FooType<T extends NonExistentType = NonExistentType> { | |
| data: T; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** @import {FooType} from './foo.d.ts' */ | |
| /** @type {FooType | null} */ | |
| let foo = null; | |
| export function getFoo() { | |
| return foo; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
| { | |
| "compilerOptions": { | |
| "allowJs": true, | |
| "checkJs": true, | |
| "strict": true, | |
| "outDir": "dist", | |
| "declaration": true, | |
| "emitDeclarationOnly": true, | |
| "target": "es2022", | |
| "module": "node16", | |
| "moduleResolution": "node16", | |
| "noUnusedLocals": true, | |
| "noUnusedParameters": true | |
| }, | |
| "include": ["src/**/*"] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment