[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7ABJVTAW0EJKJ28PJRVBMS7":3,"skill-same:01M7ABJVTAW0EJKJ28PJRVBMS7":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":14,"repositoryHtmlUrl":29,"repositoryHomepageUrl":30,"ownerHtmlUrl":31,"ownerBlogUrl":32,"ownerDescription":6,"updatedAt":33,"install":34,"resources":47},"01M7ABJVTAW0EJKJ28PJRVBMS7","advanced-types",null,"Type-level TypeScript. Use when a type resolves to any\u002Fnever\u002Funknown or refuses to narrow, when writing reusable type utilities or type tests, or when type-checking is slow or hits a depth error (ts2589).","j0hanz\u002Fj0hanz-marketplace","j0hanz","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F159924955?v=4","01M7ABFK415CKHXYV9GZRJ16T7","Linus Johansson","01M7ABFK52FCPP2PNBH1YR7ZPA",0,"MIT","https:\u002F\u002Fgithub.com\u002Fj0hanz\u002Fj0hanz-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Ftypescript-pro\u002Fskills\u002Fadvanced-types\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: advanced-types\ndescription: Type-level TypeScript. Use when a type resolves to any\u002Fnever\u002Funknown or refuses to narrow, when writing reusable type utilities or type tests, or when type-checking is slow or hits a depth error (ts2589).\nmetadata:\n  category: reference\n---\n\n# Type-Level TypeScript\n\nType-level code has no runtime, no debugger. Compiler only oracle.\n\n## The loop\n\n1. **Red first.** Before type exist, write assertions: one `Expect\u003CEquals\u003C…>>` per case must hold, one `@ts-expect-error` per case must be rejected. Done when every `Expect\u003CEquals>` red (tsc errors on it) and every `@ts-expect-error` line red because underlying assertion does _not_ error — no assertion vacuously passing, none vacuously silent. Assertion already passing against type not written yet tests nothing.\n\n2. **Probe one operator at a time.** Grow type by one operator, keep probe beside it (`type _p = YourType\u003CSampleInput>`), read what it resolves to. Done when every probe resolves to type you can name — `any`, `never`, `unknown`, `{}` mean fix the operator that made it before adding next.\n\n3. **Green, then prove it can go red.** Done when `tsc --noEmit` clean _and_ changing any assertion's expected type turns it red again. Why `Equals` below replaces mutual-`extends` check: `[X] extends [Y] ? [Y] extends [X]` calls `any` equal to everything, so never goes red.\n\n4. **Budget, when it bites.** On editor lag or `ts2589 Type instantiation is excessively deep and possibly infinite`, measure before rewrite — `tsc --noEmit --extendedDiagnostics` for instantiation counts, `tsc --generateTrace trace\u002F` plus `npx @typescript\u002Fanalyze-trace trace\u002F` for hot type. Cost rules and order live in ## Budget. Done when named cost gone from second trace, not when code merely reads simpler.\n\n### Harness\n\n```ts\ntype Equals\u003CX, Y> =\n  (\u003CT>() => T extends X ? 1 : 2) extends \u003CT>() => T extends Y ? 1 : 2 ? true : false;\ntype Expect\u003CT extends true> = T;\ntype Prettify\u003CT> = { [K in keyof T]: T[K] } & {};\n\ntype _1 = Expect\u003CEquals\u003CSplit\u003C'a.b'>, ['a', 'b']>>;\n\u002F\u002F @ts-expect-error — this comment errors if the line below ever stops erroring\ntype _2 = Expect\u003CEquals\u003CSplit\u003C'a.b'>, string[]>>;\n```\n\n`Equals` compares identity, not structure: `A & B` not identical to object it merges into, so intersection fails assertion that looks obviously true. Probe and assert through `Prettify` whenever one in play — also what makes tooltip print merged shape instead of operands.\n\n## Distribution\n\nNaked type parameter in checked position distributes over unions: conditional runs once per member, results union back.\n\n```ts\ntype IsString\u003CT> = T extends string ? 'yes' : 'no';\ntype A = IsString\u003Cstring | number>; \u002F\u002F \"yes\" | \"no\"  — ran twice\ntype B = IsString\u003Cnever>; \u002F\u002F never — empty union, ran zero times\ntype C = IsString\u003Cany>; \u002F\u002F \"yes\" | \"no\" — any satisfies both branches\n```\n\nWrap both sides in tuple to switch distribution off, test union whole:\n\n```ts\ntype IsStringWhole\u003CT> = [T] extends [string] ? 'yes' : 'no';\ntype D = IsStringWhole\u003Cstring | number>; \u002F\u002F \"no\"\ntype E = IsStringWhole\u003Cnever>; \u002F\u002F \"yes\" — never is assignable to string; only distribution made the naked version collapse to never\n```\n\n`boolean` is union `true | false`, so distributes too — `Exclude\u003Cboolean, false>` is `true`. `any` passes every constraint, so detect explicit: `type IsAny\u003CT> = 0 extends 1 & T ? true : false`.\n\nConditional over parameter compiler hasn't substituted yet — inside generic function body — stays deferred instead of resolving, and neither branch assignable to deferred conditional. Assert once, at boundary:\n\n```ts\nfunction toBit\u003CT extends boolean>(t: T): T extends true ? 1 : 0 {\n  return (t ? 1 : 0) as T extends true ? 1 : 0; \u002F\u002F the return is the boundary\n}\n```\n\n## Homomorphic mapped types\n\n`{ [K in keyof T]: … }` homomorphic: copies `readonly` and `?` off source property, maps arrays to arrays and tuples to tuples instead of index signature. `+`\u002F`-` edit those modifiers.\n\n```ts\ntype Mutable\u003CT> = { -readonly [K in keyof T]: T[K] };\ntype Concrete\u003CT> = { [K in keyof T]-?: T[K] };\n```\n\nHomomorphism tied to key source being literally `keyof T` (or `K extends keyof T` parameter — why `Pick` keeps modifiers). Change that source and modifiers vanish silently:\n\n```ts\ninterface Row {\n  readonly id: string;\n  note?: string;\n}\ntype Copy\u003CT> = { [K in keyof T]: T[K] }; \u002F\u002F readonly id, note?\ntype Rebuilt\u003CT> = { [K in keyof T & string]: T[K] }; \u002F\u002F id, note — both modifiers gone\n```\n\nRemap with `as` — to `never` to drop key, to template literal to rename it.\n\n```ts\ntype FnKeys\u003CT> = { [K in keyof T as T[K] extends Function ? K : never]: T[K] };\ntype Getters\u003CT> = {\n  [K in keyof T as `get${Capitalize\u003CK & string>}`]: () => T[K];\n};\n```\n\n`Capitalize`, `Uncapitalize`, `Uppercase`, `Lowercase` are compiler's four intrinsic string transforms — nothing else reaches inside string type. `& string` load-bearing: `keyof T` admits `symbol`, and no template literal accepts one.\n\n`keyof` over index signature wider than it looks: `keyof { [k: string]: number }` is `string | number`.\n\n## infer and variance\n\nRepeat an `infer` name and its position decides how candidates combine — covariant positions union, contravariant (function parameter) positions intersect.\n\n```ts\ntype Co\u003CT> = T extends { a: infer U; b: infer U } ? U : never; \u002F\u002F A | B\ntype Contra\u003CT> = T extends { a: (x: infer U) => void; b: (x: infer U) => void } ? U : never; \u002F\u002F A & B\n\ntype UnionToIntersection\u003CU> = (U extends unknown ? (x: U) => void : never) extends (\n  x: infer I,\n) => void\n  ? I\n  : never;\n```\n\nSame variance rule governs assignability, and method syntax opts out: `{ on(e: E): void }` stays bivariant in parameters even under `strictFunctionTypes`, while `{ on: (e: E) => void }` contravariant. Declare callbacks as properties to get strict check.\n\nState variance on parameter when generic gets compared over and over — `interface Box\u003Cout T>` covariant, `\u003Cin T>` contravariant, `\u003Cin out T>` invariant. Compiler checks annotation against structure, so wrong one is error not silent cast, then relates `Box\u003CA>` to `Box\u003CB>` by relating `A` to `B` instead of walking members.\n\nConstrain inline (`infer H extends string`) instead of second conditional to re-narrow.\n\nTemplate-literal inference non-greedy — first placeholder takes shortest match:\n\n```ts\ntype Head\u003CS> = S extends `${infer H}.${infer R}` ? [H, R] : never;\ntype X = Head\u003C'a.b.c'>; \u002F\u002F [\"a\", \"b.c\"]\n```\n\n## Values as types\n\n`typeof` lifts value into type space. Takes identifier or property path, never expression — call's result comes back through `ReturnType\u003Ctypeof f>`.\n\n```ts\nconst config = { mode: 'dark', retries: 3 } as const;\ntype Key = keyof typeof config; \u002F\u002F \"mode\" | \"retries\"\ntype Mode = (typeof config)['mode']; \u002F\u002F \"dark\"\n\nconst roles = ['admin', 'user'] as const;\ntype Role = (typeof roles)[number]; \u002F\u002F \"admin\" | \"user\"\n```\n\n`as const` plus `[number]` is type-level `enum`: array stays one source of values, and unlike `enum` emits no runtime object.\n\nIndexed access distributes over key union — `T[\"a\" | \"b\"]` is `T[\"a\"] | T[\"b\"]`, so `T[keyof T]` is every value type — and reading optional property carries absence with it: `{ a?: string }[\"a\"]` is `string | undefined`.\n\n## Widen and narrow\n\nWidening happens at binding, not at literal: `const s = \"on\"` stays `\"on\"`, `let s = \"on\"` becomes `string`, object literal's properties widen under both unless literal frozen with `as const`. Three more tools stop it further out.\n\n```ts\nconst routes = { home: '\u002F' } satisfies Record\u003Cstring, `\u002F${string}`>; \u002F\u002F checked, stays \"\u002F\"\ndeclare function tuple\u003Cconst T extends readonly unknown[]>(...xs: T): T; \u002F\u002F literal inference at the call site\ndeclare function pick\u003CT>(xs: T[], fallback: NoInfer\u003CT>): T; \u002F\u002F one site excluded from inference\n```\n\nLiteral union that also admits own supertype collapses into it — `\"dark\" | \"light\" | string` is `string`, autocomplete and all. Intersect wide member to keep literals: `\"dark\" | \"light\" | (string & {})`.\n\nNarrowing follows control flow, which makes it survive less than expected in some places, more in others:\n\n- `const` holding the test narrows at `if` (`const isStr = typeof x === \"string\"`), provided nothing reassigns subject.\n- Narrowed _property_ (`o.a`) back to declared type inside any callback, `readonly` or not; narrowed _variable_ survives into one as long as nothing assigns it after. Pin property to `const`, close over that.\n- TS 5.5 infers `x is T` for function whose body is narrowing expression, so `xs.filter(x => x !== null)` yields narrowed array, no hand-written predicate.\n- `switch` or `if`-chain missing a union member doesn't error — return type silently gains `| undefined`. Assign scrutinee to `never` in default branch (`const _: never = s`) to make missing case compile error.\n- `asserts x is T` requires explicit type annotation on every name in call target (`ts2775`) — inferred `const assertIsUser = …` silently fails to assert.\n- Excess-property checks fire on fresh object literals only; same object assigned through variable passes with extra properties.\n\n## Brands\n\nType alias transparent: `type UserId = string` accepts every string, two aliases of one shape stay interchangeable. Intersect phantom key to make type nominal — then nothing produces it but assertion, so keep that assertion in the one function that validates.\n\n```ts\ndeclare const brand: unique symbol;\ntype Brand\u003CT, B> = T & { readonly [brand]: B };\n\ntype UserId = Brand\u003Cstring, 'UserId'>;\nconst toUserId = (s: string): UserId => {\n  if (!s.startsWith('u_')) throw new Error(`not an id: ${s}`);\n  return s as UserId; \u002F\u002F the validator is the boundary\n};\n```\n\n## Budget\n\nRecursion: conditional type whose recursive call _is_ the branch gets tail-eliminated, runs ~1000 deep; wrap that call in anything — template literal, tuple, another conditional — and ceiling drops to ~100.\n\n```ts\ntype Join\u003CT extends string[], Acc extends string = ''> = T extends [\n  infer H extends string,\n  ...infer R extends string[],\n]\n  ? Join\u003CR, `${Acc}${H}`> \u002F\u002F tail position: accumulate in a parameter\n  : Acc;\n```\n\nCost, in order it usually bites:\n\n- `interface` by default for object shapes — compiler caches interface's relationship checks and names it in errors, while alias built with `&` re-elaborates at every use. Reach for `type` when shape can't be interface: union, tuple, mapped, conditional.\n- Annotate return types on exported functions so declaration emit doesn't re-infer them.\n- Union × union comparison costs the product; shared base type collapses it. Template literal over unions _materialises_ that product as members, and past ~100k compiler quits outright with ts2590 `Expression produces a union type that is too complex to represent` — match wide side with `infer` instead of enumerating it.\n","# Type-Level TypeScript\n\nType-level code has no runtime, no debugger. Compiler only oracle.\n\n## The loop\n\n1. **Red first.** Before type exist, write assertions: one `Expect\u003CEquals\u003C…>>` per case must hold, one `@ts-expect-error` per case must be rejected. Done when every `Expect\u003CEquals>` red (tsc errors on it) and every `@ts-expect-error` line red because underlying assertion does _not_ error — no assertion vacuously passing, none vacuously silent. Assertion already passing against type not written yet tests nothing.\n\n2. **Probe one operator at a time.** Grow type by one operator, keep probe beside it (`type _p = YourType\u003CSampleInput>`), read what it resolves to. Done when every probe resolves to type you can name — `any`, `never`, `unknown`, `{}` mean fix the operator that made it before adding next.\n\n3. **Green, then prove it can go red.** Done when `tsc --noEmit` clean _and_ changing any assertion's expected type turns it red again. Why `Equals` below replaces mutual-`extends` check: `[X] extends [Y] ? [Y] extends [X]` calls `any` equal to everything, so never goes red.\n\n4. **Budget, when it bites.** On editor lag or `ts2589 Type instantiation is excessively deep and possibly infinite`, measure before rewrite — `tsc --noEmit --extendedDiagnostics` for instantiation counts, `tsc --generateTrace trace\u002F` plus `npx @typescript\u002Fanalyze-trace trace\u002F` for hot type. Cost rules and order live in ## Budget. Done when named cost gone from second trace, not when code merely reads simpler.\n\n### Harness\n\n```ts\ntype Equals\u003CX, Y> =\n  (\u003CT>() => T extends X ? 1 : 2) extends \u003CT>() => T extends Y ? 1 : 2 ? true : false;\ntype Expect\u003CT extends true> = T;\ntype Prettify\u003CT> = { [K in keyof T]: T[K] } & {};\n\ntype _1 = Expect\u003CEquals\u003CSplit\u003C'a.b'>, ['a', 'b']>>;\n\u002F\u002F @ts-expect-error — this comment errors if the line below ever stops erroring\ntype _2 = Expect\u003CEquals\u003CSplit\u003C'a.b'>, string[]>>;\n```\n\n`Equals` compares identity, not structure: `A & B` not identical to object it merges into, so intersection fails assertion that looks obviously true. Probe and assert through `Prettify` whenever one in play — also what makes tooltip print merged shape instead of operands.\n\n## Distribution\n\nNaked type parameter in checked position distributes over unions: conditional runs once per member, results union back.\n\n```ts\ntype IsString\u003CT> = T extends string ? 'yes' : 'no';\ntype A = IsString\u003Cstring | number>; \u002F\u002F \"yes\" | \"no\"  — ran twice\ntype B = IsString\u003Cnever>; \u002F\u002F never — empty union, ran zero times\ntype C = IsString\u003Cany>; \u002F\u002F \"yes\" | \"no\" — any satisfies both branches\n```\n\nWrap both sides in tuple to switch distribution off, test union whole:\n\n```ts\ntype IsStringWhole\u003CT> = [T] extends [string] ? 'yes' : 'no';\ntype D = IsStringWhole\u003Cstring | number>; \u002F\u002F \"no\"\ntype E = IsStringWhole\u003Cnever>; \u002F\u002F \"yes\" — never is assignable to string; only distribution made the naked version collapse to never\n```\n\n`boolean` is union `true | false`, so distributes too — `Exclude\u003Cboolean, false>` is `true`. `any` passes every constraint, so detect explicit: `type IsAny\u003CT> = 0 extends 1 & T ? true : false`.\n\nConditional over parameter compiler hasn't substituted yet — inside generic function body — stays deferred instead of resolving, and neither branch assignable to deferred conditional. Assert once, at boundary:\n\n```ts\nfunction toBit\u003CT extends boolean>(t: T): T extends true ? 1 : 0 {\n  return (t ? 1 : 0) as T extends true ? 1 : 0; \u002F\u002F the return is the boundary\n}\n```\n\n## Homomorphic mapped types\n\n`{ [K in keyof T]: … }` homomorphic: copies `readonly` and `?` off source property, maps arrays to arrays and tuples to tuples instead of index signature. `+`\u002F`-` edit those modifiers.\n\n```ts\ntype Mutable\u003CT> = { -readonly [K in keyof T]: T[K] };\ntype Concrete\u003CT> = { [K in keyof T]-?: T[K] };\n```\n\nHomomorphism tied to key source being literally `keyof T` (or `K extends keyof T` parameter — why `Pick` keeps modifiers). Change that source and modifiers vanish silently:\n\n```ts\ninterface Row {\n  readonly id: string;\n  note?: string;\n}\ntype Copy\u003CT> = { [K in keyof T]: T[K] }; \u002F\u002F readonly id, note?\ntype Rebuilt\u003CT> = { [K in keyof T & string]: T[K] }; \u002F\u002F id, note — both modifiers gone\n```\n\nRemap with `as` — to `never` to drop key, to template literal to rename it.\n\n```ts\ntype FnKeys\u003CT> = { [K in keyof T as T[K] extends Function ? K : never]: T[K] };\ntype Getters\u003CT> = {\n  [K in keyof T as `get${Capitalize\u003CK & string>}`]: () => T[K];\n};\n```\n\n`Capitalize`, `Uncapitalize`, `Uppercase`, `Lowercase` are compiler's four intrinsic string transforms — nothing else reaches inside string type. `& string` load-bearing: `keyof T` admits `symbol`, and no template literal accepts one.\n\n`keyof` over index signature wider than it looks: `keyof { [k: string]: number }` is `string | number`.\n\n## infer and variance\n\nRepeat an `infer` name and its position decides how candidates combine — covariant positions union, contravariant (function parameter) positions intersect.\n\n```ts\ntype Co\u003CT> = T extends { a: infer U; b: infer U } ? U : never; \u002F\u002F A | B\ntype Contra\u003CT> = T extends { a: (x: infer U) => void; b: (x: infer U) => void } ? U : never; \u002F\u002F A & B\n\ntype UnionToIntersection\u003CU> = (U extends unknown ? (x: U) => void : never) extends (\n  x: infer I,\n) => void\n  ? I\n  : never;\n```\n\nSame variance rule governs assignability, and method syntax opts out: `{ on(e: E): void }` stays bivariant in parameters even under `strictFunctionTypes`, while `{ on: (e: E) => void }` contravariant. Declare callbacks as properties to get strict check.\n\nState variance on parameter when generic gets compared over and over — `interface Box\u003Cout T>` covariant, `\u003Cin T>` contravariant, `\u003Cin out T>` invariant. Compiler checks annotation against structure, so wrong one is error not silent cast, then relates `Box\u003CA>` to `Box\u003CB>` by relating `A` to `B` instead of walking members.\n\nConstrain inline (`infer H extends string`) instead of second conditional to re-narrow.\n\nTemplate-literal inference non-greedy — first placeholder takes shortest match:\n\n```ts\ntype Head\u003CS> = S extends `${infer H}.${infer R}` ? [H, R] : never;\ntype X = Head\u003C'a.b.c'>; \u002F\u002F [\"a\", \"b.c\"]\n```\n\n## Values as types\n\n`typeof` lifts value into type space. Takes identifier or property path, never expression — call's result comes back through `ReturnType\u003Ctypeof f>`.\n\n```ts\nconst config = { mode: 'dark', retries: 3 } as const;\ntype Key = keyof typeof config; \u002F\u002F \"mode\" | \"retries\"\ntype Mode = (typeof config)['mode']; \u002F\u002F \"dark\"\n\nconst roles = ['admin', 'user'] as const;\ntype Role = (typeof roles)[number]; \u002F\u002F \"admin\" | \"user\"\n```\n\n`as const` plus `[number]` is type-level `enum`: array stays one source of values, and unlike `enum` emits no runtime object.\n\nIndexed access distributes over key union — `T[\"a\" | \"b\"]` is `T[\"a\"] | T[\"b\"]`, so `T[keyof T]` is every value type — and reading optional property carries absence with it: `{ a?: string }[\"a\"]` is `string | undefined`.\n\n## Widen and narrow\n\nWidening happens at binding, not at literal: `const s = \"on\"` stays `\"on\"`, `let s = \"on\"` becomes `string`, object literal's properties widen under both unless literal frozen with `as const`. Three more tools stop it further out.\n\n```ts\nconst routes = { home: '\u002F' } satisfies Record\u003Cstring, `\u002F${string}`>; \u002F\u002F checked, stays \"\u002F\"\ndeclare function tuple\u003Cconst T extends readonly unknown[]>(...xs: T): T; \u002F\u002F literal inference at the call site\ndeclare function pick\u003CT>(xs: T[], fallback: NoInfer\u003CT>): T; \u002F\u002F one site excluded from inference\n```\n\nLiteral union that also admits own supertype collapses into it — `\"dark\" | \"light\" | string` is `string`, autocomplete and all. Intersect wide member to keep literals: `\"dark\" | \"light\" | (string & {})`.\n\nNarrowing follows control flow, which makes it survive less than expected in some places, more in others:\n\n- `const` holding the test narrows at `if` (`const isStr = typeof x === \"string\"`), provided nothing reassigns subject.\n- Narrowed _property_ (`o.a`) back to declared type inside any callback, `readonly` or not; narrowed _variable_ survives into one as long as nothing assigns it after. Pin property to `const`, close over that.\n- TS 5.5 infers `x is T` for function whose body is narrowing expression, so `xs.filter(x => x !== null)` yields narrowed array, no hand-written predicate.\n- `switch` or `if`-chain missing a union member doesn't error — return type silently gains `| undefined`. Assign scrutinee to `never` in default branch (`const _: never = s`) to make missing case compile error.\n- `asserts x is T` requires explicit type annotation on every name in call target (`ts2775`) — inferred `const assertIsUser = …` silently fails to assert.\n- Excess-property checks fire on fresh object literals only; same object assigned through variable passes with extra properties.\n\n## Brands\n\nType alias transparent: `type UserId = string` accepts every string, two aliases of one shape stay interchangeable. Intersect phantom key to make type nominal — then nothing produces it but assertion, so keep that assertion in the one function that validates.\n\n```ts\ndeclare const brand: unique symbol;\ntype Brand\u003CT, B> = T & { readonly [brand]: B };\n\ntype UserId = Brand\u003Cstring, 'UserId'>;\nconst toUserId = (s: string): UserId => {\n  if (!s.startsWith('u_')) throw new Error(`not an id: ${s}`);\n  return s as UserId; \u002F\u002F the validator is the boundary\n};\n```\n\n## Budget\n\nRecursion: conditional type whose recursive call _is_ the branch gets tail-eliminated, runs ~1000 deep; wrap that call in anything — template literal, tuple, another conditional — and ceiling drops to ~100.\n\n```ts\ntype Join\u003CT extends string[], Acc extends string = ''> = T extends [\n  infer H extends string,\n  ...infer R extends string[],\n]\n  ? Join\u003CR, `${Acc}${H}`> \u002F\u002F tail position: accumulate in a parameter\n  : Acc;\n```\n\nCost, in order it usually bites:\n\n- `interface` by default for object shapes — compiler caches interface's relationship checks and names it in errors, while alias built with `&` re-elaborates at every use. Reach for `type` when shape can't be interface: union, tuple, mapped, conditional.\n- Annotate return types on exported functions so declaration emit doesn't re-infer them.\n- Union × union comparison costs the product; shared base type collapses it. Template literal over unions _materialises_ that product as members, and past ~100k compiler quits outright with ts2590 `Expression produces a union type that is too complex to represent` — match wide side with `infer` instead of enumerating it.\n",{"name":5,"metadata":24,"description":7},{"category":25},"reference","main","534498267dccbe415f22f31fceac9da6771c195f","plugins\u002Ftypescript-pro\u002Fskills\u002Fadvanced-types","https:\u002F\u002Fgithub.com\u002Fj0hanz\u002Fj0hanz-marketplace","https:\u002F\u002Fj0hanz-marketplace.vercel.app","https:\u002F\u002Fgithub.com\u002Fj0hanz","linus-johansson-cv-d308be9b73e1.herokuapp.com","2026-11-15 02:42:07",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add j0hanz\u002Fj0hanz-marketplace --skill advanced-types",{"tool":40,"command":41},"bunx","bunx skills add j0hanz\u002Fj0hanz-marketplace --skill advanced-types",{"tool":43,"command":44},"pnpm","pnpm dlx skills add j0hanz\u002Fj0hanz-marketplace --skill advanced-types","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fj0hanz\u002Fj0hanz-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Ftypescript-pro\u002Fskills\u002Fadvanced-types\u002FSKILL.md",true,[],[49,56,63,70,77,84],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M7ABP78JFYBMCXJ9GMETCYZM","unslop","Use when writing or editing prose a person will read, or when text sounds AI-generated.","https:\u002F\u002Fgithub.com\u002Fj0hanz\u002Fj0hanz-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fwriteup\u002Fskills\u002Funslop\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7ABP52BNV7NRPNBR6PCNZWC","show-me","Use when asked to show, diagram, or walk through how code fits together or what a change does, or before explaining a multi-file flow in prose.","https:\u002F\u002Fgithub.com\u002Fj0hanz\u002Fj0hanz-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fwriteup\u002Fskills\u002Fshow-me\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7ABP3EPN4KFB4HPJNMY31NR","pr","Use when writing or updating a pull request description, or before running `gh pr create`.","https:\u002F\u002Fgithub.com\u002Fj0hanz\u002Fj0hanz-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fwriteup\u002Fskills\u002Fpr\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7ABP08MXTHPZYTG4HKEP7WQ","commit","Use when writing a commit message, or before running `git commit`.","https:\u002F\u002Fgithub.com\u002Fj0hanz\u002Fj0hanz-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fwriteup\u002Fskills\u002Fcommit\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7ABNV9J7DN1AFRBGDBHVBY2","write-specs","Spec a feature's observable behavior. Use when asked for requirements, when a request says what the system should do but not how, or to capture what a built system already guarantees. Not for how to build it (write-plan).","https:\u002F\u002Fgithub.com\u002Fj0hanz\u002Fj0hanz-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fworkbench\u002Fskills\u002Fwrite-specs\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M7ABNPK2GVG8EB3SSEAMK4FZ","write-skills","Write, fix, or audit a skill's frontmatter, trigger description, and body. Use when a skill is asked for, never fires, or fires at the wrong moment. Not for a hook (write-hooks) or the plugin manifest and catalog.","https:\u002F\u002Fgithub.com\u002Fj0hanz\u002Fj0hanz-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fworkbench\u002Fskills\u002Fwrite-skills\u002FSKILL.md",[],[]]