Skip to content

Instantly share code, notes, and snippets.

@43081j
Last active July 25, 2025 19:03
Show Gist options
  • Select an option

  • Save 43081j/8628fc331362eafdf82ce7933dcb7839 to your computer and use it in GitHub Desktop.

Select an option

Save 43081j/8628fc331362eafdf82ce7933dcb7839 to your computer and use it in GitHub Desktop.
sveltekit type fudgery
export function getFoo(): FooType<NonExistentType> | null;
import type { FooType } from './foo.d.ts';
import {
NonExistentType
// @ts-ignore
} from "$nonExistent";
export interface FooType<T extends NonExistentType = NonExistentType> {
data: T;
}
/** @import {FooType} from './foo.d.ts' */
/** @type {FooType | null} */
let foo = null;
export function getFoo() {
return foo;
}
{
"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