Skip to content

Commit 2949923

Browse files
authored
fix(types): cut consumer type-check cost for polymorphic components (#5783)
* fix(types): cut consumer type-check cost for polymorphic components Target props are now derived by one flat conditional that resolves HTML tags through an indexed access on JSX.IntrinsicElements, instead of two nested conditionals bottoming out in ComponentPropsWithRef. The old shape was distributive with a ~153-member target union in its constraint, so every constraint probe re-instantiated the conditional once per union member. Each of those instantiations dragged in ComponentPropsWithRef, which on @types/react 18 rebuilds the entire prop bag through Omit purely to strip legacy string refs. On a 100-component fixture that made ComponentPropsWithRef roughly a third of the program's whole type population, up more than 100x from 6.4.2. Net on a 500-component fixture, measured against the built declarations: check time drops to about a third of 6.4.4's and memory to about a third, putting instantiation count slightly under 6.4.2's. Bracketing the conditional is not the fix and makes things worse: the `T & KnownTarget` needed to restore narrowing cross-products two ~153-member unions and exhausts the heap. Folding the KnownTarget test into the helper's own AnyComponent arm is what makes it cheap; nesting a check back on top costs roughly 4x the check time. The deprecated NoInfer alias moves to its own module and is re-exported. Declaring it alongside its own uses shadowed the TypeScript intrinsic within that file and downgraded both hot references to the slower deferred form; a re-export introduces no local binding. It was never exported from the package entry, but resolves via a deep import that at least one published library relies on, so it is kept. Adds a consumer type-check budget to CI, measured against the built declarations, because nothing in the existing suites can observe this class of regression. Fixes #5767 * fix(types): make MakeAttrsOptional short-circuit when there are no attrs The guard was `keyof K extends never`, but `K` is the set of attrs keys and is `never` for any component without `.attrs()`. `keyof never` is `string | number | symbol`, so the short-circuit never fired: every such component instantiated an omit plus a `Partial<Pick<...>>` that removed and re-added nothing, and intersected the empty object into its own props, which never reduces. Present since well before this branch. Removing it drops instantiations by about 15% and check time by about 10% on top of the rest, and roughly halves the length of the type shown on hover.
1 parent 5f69a30 commit 2949923

9 files changed

Lines changed: 317 additions & 15 deletions

File tree

‎.changeset/wild-hoops-shake.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'styled-components': patch
3+
---
4+
5+
Large TypeScript projects type-check dramatically faster. On a 500-component app, `tsc` check time drops to about a third of what 6.4.4 takes and peak memory to about a third, which resolves the out-of-memory failures some projects hit after upgrading past 6.4.2. Editor responsiveness improves by the same margin, and autocomplete on `as` targets is unchanged.

‎.github/workflows/test.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ jobs:
4242
- run: pnpm build
4343
env:
4444
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
45+
46+
# Guards consumer type-check cost against the built .d.ts. Regressions here
47+
# are invisible to the unit and type-contract suites (see #5767).
48+
- run: pnpm --filter styled-components type-perf
4549
test:
4650
runs-on: ubuntu-latest
4751
steps:

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ mount-deep-tree-trace.json
1717
mount-wide-tree-trace.json
1818
update-dynamic-styles-trace.json
1919
.rollup.cache
20+
# Generated consumer fixture for the type-check budget (`pnpm --filter styled-components type-perf`)
21+
.type-perf
2022
.build
2123
.next
2224
.expo

‎AGENTS.md‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ NOTE: CLAUDE.md is a symlink to this file (AGENTS.md). Edit AGENTS.md directly.
4141
- `pnpm --filter sandbox dev` -- Start Next.js dev server
4242
- `pnpm --filter styled-components test:web` -- Test web build
4343
- `pnpm --filter styled-components test:native` -- Test React Native
44+
- `pnpm --filter styled-components type-perf` -- Consumer type-check budget (needs `pnpm build` first)
4445
- `pnpm --filter styled-components bench` -- Run all benchmarks (web + native + RSC)
4546
- `pnpm --filter styled-components bench:web` -- Run web benchmarks
4647
- `pnpm --filter styled-components bench:native` -- Run native benchmarks (parser + render)
@@ -111,8 +112,19 @@ NOTE: CLAUDE.md is a symlink to this file (AGENTS.md). Edit AGENTS.md directly.
111112

112113
## TypeScript Type Performance
113114

114-
- `OverrideStyle` accounts for ~22% of type instantiations (measured via ablation). Cannot be simplified without breaking `exactOptionalPropertyTypes` or JSX overload resolution. Do not touch without a major version plan.
115-
- Use built-in `NoInfer` (TS 5.4+) internally; the export in `types.ts` is for downstream consumers only
115+
Consumer cost is budgeted in CI: `pnpm --filter styled-components type-perf` type-checks a generated
116+
fixture against the built `dist/*.d.ts` and fails when types or instantiations exceed
117+
`type-perf.budget.json`. Measure there, not against `src`, since internal files don't reach consumers.
118+
Raise the budget with `--update` only after understanding why the cost grew.
119+
120+
- `TargetProps<T>` (`types.ts`) must stay ONE distributive conditional. Wrapping it in an outer `T extends KnownTarget ? … : {}` check nests two distributions over the ~153-member target union and costs ~4x the check time; folding the KnownTarget test into the helper's own `AnyComponent` arm is what makes it cheap.
121+
- Resolve HTML tag props by indexed access (`React.JSX.IntrinsicElements[T]`), never `React.ComponentPropsWithRef<T>`. On @types/react 18 the latter rebuilds the whole ~265-key prop bag through `Omit` just to strip legacy string refs; the indexed access already carries `ref` via `DetailedHTMLProps`. This was the entire #5767 regression: `ComponentPropsWithRef` went from 496 to 59,944 types in a 100-component fixture.
122+
- Do NOT "fix" a distributive conditional by bracketing it as `[T] extends [X] ? F<T & X> : …`. The `T & X` intersection cross-products two ~153-member unions and OOMs tsc. Bracketing is only safe when the true branch doesn't need `T` narrowed.
123+
- `OverrideStyle` is the largest remaining consumer cost, because it runs on the whole merged prop bag at every JSX call site, so its `Omit` is a fresh mapped type per styled component. Two routes were measured and neither shipped; the old note here blamed JSX overload resolution, which is stale since the overloads became a single call signature in 6.4.3.
124+
- Intersect instead of omit (`P & { style?: … }`): -33% types, -22% check time. Not behavior-preserving, since `Omit` *replaces* the style type where an intersection *narrows* it, so a component declaring `style?: { width: number }` accepts arbitrary CSS today and would stop.
125+
- Widen at the source: apply it once per target inside `TargetProps` and at the `styled.tag` / native maps, and drop it from both call-site positions. This is the big one: 500-component fixture goes 4.61s to 2.75s and 630K to 127K types, beating even 6.4.2. It needs a minor, not a patch. Three behavior deltas, each defensible but real: an explicitly declared `style` type (`styled.div<{ style?: MyStyle }>`) starts overriding rather than unioning; `style={undefined}` needs an explicit `| undefined` restored; and `React.ComponentProps<X>['style']` starts reflecting the widening, which today it silently does not. It also needs `'style' extends keyof P` rather than `P extends { style?: infer S }`, since `{}` vacuously satisfies the latter and would hand every un-introspectable target a `style` key, defeating `WidenUntypedProps` and regressing #5756. Expect knock-on work in `StyledComponent`/`StyledNativeComponent` where `Attrs<any>` stops relating to `Attrs<OuterProps>`.
126+
- Use built-in `NoInfer` (TS 5.4+) internally. Never declare a local `NoInfer` alias in a file that also uses it: the local declaration shadows the intrinsic within that module and silently downgrades every reference to the slower deferred form.
127+
- `tsc --noEmit` cannot see editor behavior. A change to the polymorphic call signature must also be checked by driving a real tsserver at a half-typed JSX attribute (`<Comp as="video" l|>` must still offer `loop`). Always include a positive control in that probe: a caret that lands wrong returns zero completions, which reads identically to a genuine regression.
116128
- `FastOmit<A, K> & B` (intersection) is 2.4x fewer instantiations than a single mapped type with per-key conditionals
117129
- Homomorphic mapped types (`{ [K in keyof P]: ... }`) break React JSX overload resolution
118130
- Flattening nested `Substitute` into parallel `FastOmit`s increases instantiations — TS deduplicates nested structures better

‎packages/styled-components/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"pretest": "pnpm run generateErrors",
2525
"test": "pnpm run test:web && pnpm run test:native && pnpm run test:types",
2626
"test:types": "tsc --noEmit --project tsconfig.test-types.json",
27+
"type-perf": "node scripts/typePerf.mjs",
2728
"test:web": "jest -c jest.config.main.js",
2829
"test:native": "jest -c jest.config.native.js --forceExit",
2930
"bench": "pnpm run bench:web && pnpm run bench:native && pnpm run bench:rsc",
Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
#!/usr/bin/env node
2+
/**
3+
* Consumer type-check budget.
4+
*
5+
* Generates a fixture in the shape large apps actually have -- many styled
6+
* components, `styled(Component)` wrapping, attrs chains, and a minority of
7+
* polymorphic `as` call sites -- type-checks it against the BUILT `dist/*.d.ts`
8+
* (what consumers and editors resolve, not `src`), and fails when types or
9+
* instantiations exceed the committed budget.
10+
*
11+
* This exists because 6.4.3 shipped a regression that tripled consumer
12+
* type-check cost and nothing in CI could see it (#5767).
13+
*
14+
* node scripts/typePerf.mjs check against the budget
15+
* node scripts/typePerf.mjs --update rewrite the budget from this run
16+
* node scripts/typePerf.mjs --count 500
17+
*
18+
* Requires `pnpm build` first.
19+
*/
20+
import { execFileSync } from 'node:child_process';
21+
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
22+
import { dirname, join, resolve } from 'node:path';
23+
import { fileURLToPath } from 'node:url';
24+
25+
const pkgRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
26+
const workDir = join(pkgRoot, '.type-perf');
27+
const budgetFile = join(pkgRoot, 'type-perf.budget.json');
28+
29+
const args = process.argv.slice(2);
30+
const update = args.includes('--update');
31+
32+
// Parsed explicitly rather than via indexOf+1, which reads argv[0] when the flag
33+
// is absent (indexOf returns -1) and silently falls back to the default when the
34+
// flag is present but valueless. A miscounted fixture measures the wrong thing.
35+
const countFlag = args.indexOf('--count');
36+
let count = 100;
37+
if (countFlag !== -1) {
38+
count = Number(args[countFlag + 1]);
39+
if (!Number.isInteger(count) || count < 1) {
40+
console.error(`type-perf: --count needs a positive integer, got ${args[countFlag + 1]}`);
41+
process.exit(1);
42+
}
43+
}
44+
45+
if (!existsSync(join(pkgRoot, 'dist', 'index.d.ts'))) {
46+
console.error('type-perf: dist/index.d.ts missing -- run `pnpm build` first.');
47+
process.exit(1);
48+
}
49+
50+
// -- fixture ---------------------------------------------------------------
51+
52+
const TAGS = ['div', 'span', 'button', 'a', 'p', 'section', 'li', 'input'];
53+
const AS_TAGS = ['a', 'button', 'label', 'section', 'video', 'ul'];
54+
55+
const HEADER = `import * as React from 'react';
56+
import styled from 'styled-components';
57+
58+
interface BaseProps {
59+
$variant?: 'primary' | 'secondary';
60+
$size?: number;
61+
$active?: boolean;
62+
label?: string;
63+
}
64+
65+
const Plain = (props: BaseProps & { className?: string; children?: React.ReactNode }) => (
66+
<div className={props.className}>{props.children}</div>
67+
);
68+
69+
const Other = (props: { href?: string; children?: React.ReactNode }) => <a {...props} />;
70+
`;
71+
72+
function unit(i) {
73+
const tag = TAGS[i % TAGS.length];
74+
const kind = i % 20;
75+
const N = `C${i}`;
76+
let decl;
77+
78+
if (kind < 8) {
79+
decl = `const ${N} = styled.${tag}<{ $a${i}?: number; $b${i}?: string; $c${i}?: boolean }>\`
80+
color: \${p => (p.$c${i} ? 'red' : 'blue')};
81+
padding: \${p => p.$a${i} ?? 0}px;
82+
\`;`;
83+
} else if (kind < 13) {
84+
decl = `const ${N} = styled(Plain)<{ $a${i}?: number }>\`
85+
margin: \${p => p.$a${i} ?? 0}px;
86+
color: \${p => (p.$active ? 'green' : 'gray')};
87+
\`;`;
88+
} else if (kind < 16) {
89+
decl = `const ${N} = styled(${i > 0 ? `C${i - 1}` : 'Plain'})<{ $x${i}?: string }>\`
90+
border-color: \${p => p.$x${i} ?? 'black'};
91+
\`;`;
92+
} else if (kind < 18) {
93+
decl = `const ${N} = styled.${tag}.attrs<{ $a${i}?: number }>({ $a${i}: ${i} })\`
94+
width: \${p => p.$a${i}}px;
95+
\`;`;
96+
} else {
97+
decl = `const ${N} = styled(Plain).attrs({ $size: ${i} })\`
98+
height: \${p => p.$size}px;
99+
\`;`;
100+
}
101+
102+
const sites = [`<${N} />`, `<${N} className="x">{'t'}</${N}>`];
103+
if (i % 10 === 0) sites.push(`<${N} as="${AS_TAGS[i % AS_TAGS.length]}" />`);
104+
if (i % 33 === 0) sites.push(`<${N} as={Other} href="/x" />`);
105+
if (i % 50 === 0) sites.push(`<${N} forwardedAs="ul" />`);
106+
107+
return `${decl}
108+
109+
export const Use${i} = () => (
110+
<>
111+
${sites.join('\n ')}
112+
</>
113+
);
114+
`;
115+
}
116+
117+
rmSync(workDir, { recursive: true, force: true });
118+
mkdirSync(join(workDir, 'src'), { recursive: true });
119+
120+
const PER_FILE = 20;
121+
for (let start = 0, f = 0; start < count; start += PER_FILE, f++) {
122+
const body = [];
123+
for (let i = start; i < Math.min(start + PER_FILE, count); i++) body.push(unit(i));
124+
writeFileSync(join(workDir, 'src', `mod${f}.tsx`), `${HEADER}\n${body.join('\n')}`);
125+
}
126+
127+
writeFileSync(
128+
join(workDir, 'tsconfig.json'),
129+
`${JSON.stringify(
130+
{
131+
compilerOptions: {
132+
baseUrl: '.',
133+
jsx: 'react-jsx',
134+
lib: ['ES2021', 'DOM'],
135+
module: 'ESNext',
136+
moduleResolution: 'bundler',
137+
noEmit: true,
138+
// Resolve the package the way a consumer does, through its `types` entry.
139+
paths: { 'styled-components': ['..'] },
140+
skipLibCheck: true,
141+
strict: true,
142+
target: 'ES2020',
143+
types: [],
144+
},
145+
include: ['src'],
146+
},
147+
null,
148+
2
149+
)}\n`
150+
);
151+
152+
// -- measure ---------------------------------------------------------------
153+
154+
const tsc = join(pkgRoot, 'node_modules', 'typescript', 'lib', 'tsc.js');
155+
const tscPath = existsSync(tsc)
156+
? tsc
157+
: resolve(pkgRoot, '..', '..', 'node_modules', 'typescript', 'lib', 'tsc.js');
158+
159+
function run(extraArgs) {
160+
try {
161+
return execFileSync(process.execPath, [tscPath, '-p', workDir, ...extraArgs], {
162+
encoding: 'utf8',
163+
maxBuffer: 64 * 1024 * 1024,
164+
});
165+
} catch (error) {
166+
// tsc exits non-zero when the fixture has type errors; keep its output.
167+
return `${error.stdout ?? ''}${error.stderr ?? ''}`;
168+
}
169+
}
170+
171+
// A fixture that fails to resolve the package type-checks almost instantly and
172+
// looks like an enormous win. Never report numbers for a run that isn't clean.
173+
const errors = run([])
174+
.split('\n')
175+
.filter(line => line.includes('error TS'));
176+
if (errors.length > 0) {
177+
console.error(`type-perf: fixture did not compile cleanly (${errors.length} errors):`);
178+
console.error(errors.slice(0, 5).join('\n'));
179+
process.exit(1);
180+
}
181+
182+
const out = run(['--extendedDiagnostics']);
183+
const read = label => Number((out.match(new RegExp(`^${label}:\\s+(\\d+)`, 'm')) ?? [])[1]);
184+
const measured = { instantiations: read('Instantiations'), types: read('Types') };
185+
186+
if (!measured.types || !measured.instantiations) {
187+
console.error('type-perf: could not parse tsc diagnostics.\n', out);
188+
process.exit(1);
189+
}
190+
191+
const tsVersion = run(['--version']).trim();
192+
console.log(`type-perf: ${count} components, ${tsVersion}`);
193+
console.log(` types: ${measured.types.toLocaleString()}`);
194+
console.log(` instantiations: ${measured.instantiations.toLocaleString()}`);
195+
196+
if (update) {
197+
// Headroom absorbs ordinary compiler and @types/react patch drift while still
198+
// catching a regression of the size #5767 reported (+75% instantiations).
199+
const pad = n => Math.ceil((n * 1.15) / 1000) * 1000;
200+
writeFileSync(
201+
budgetFile,
202+
`${JSON.stringify(
203+
{ count, maxInstantiations: pad(measured.instantiations), maxTypes: pad(measured.types) },
204+
null,
205+
2
206+
)}\n`
207+
);
208+
console.log(`type-perf: budget updated in ${budgetFile}`);
209+
process.exit(0);
210+
}
211+
212+
const budget = JSON.parse(readFileSync(budgetFile, 'utf8'));
213+
if (budget.count !== count) {
214+
console.error(`type-perf: budget is for ${budget.count} components, measured ${count}.`);
215+
process.exit(1);
216+
}
217+
218+
const over = [
219+
['types', measured.types, budget.maxTypes],
220+
['instantiations', measured.instantiations, budget.maxInstantiations],
221+
].filter(([, actual, max]) => actual > max);
222+
223+
if (over.length > 0) {
224+
for (const [label, actual, max] of over) {
225+
console.error(
226+
`type-perf: ${label} ${actual.toLocaleString()} exceeds budget ${max.toLocaleString()} ` +
227+
`(+${Math.round((actual / max - 1) * 100)}%)`
228+
);
229+
}
230+
console.error(
231+
'Consumer type-check cost grew. Find the cause before raising the budget; ' +
232+
'run with --update only when the increase is understood and intended.'
233+
);
234+
process.exit(1);
235+
}
236+
237+
console.log('type-perf: within budget');

‎packages/styled-components/src/types.ts‎

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,31 @@ interface ThemedExecutionProps {
184184
theme?: DefaultTheme | undefined;
185185
}
186186

187+
/**
188+
* Props of a render target, for `as` / `forwardedAs`.
189+
*
190+
* One distributive conditional, never two nested. Resolving an HTML tag by
191+
* indexed access rather than through `React.ComponentPropsWithRef` is what makes
192+
* this cheap: for a tag the indexed access is a single lookup, where
193+
* `ComponentPropsWithRef` walks four more conditionals and (on @types/react 18)
194+
* rebuilds the whole ~265-key prop bag through `Omit` just to strip legacy string
195+
* refs. `React.JSX.IntrinsicElements['div']` already carries `ref` via
196+
* `DetailedHTMLProps`, so the tag branch loses nothing.
197+
*
198+
* Load-bearing shape, do not nest: wrapping this in an outer
199+
* `T extends KnownTarget ? ... : {}` check re-introduces a second distribution
200+
* over the ~153-member target union and costs roughly 4x the check time of this
201+
* flat form (measured against the #5767 reporter fixture). The `AnyComponent`
202+
* arm doubles as the KnownTarget test, and every non-target -- `void`, a custom
203+
* element string, a wrapped component's own `as` type such as Next.js Link's
204+
* `as?: Url` -- falls through to `{}` exactly as the outer check used to make it.
205+
*/
206+
type TargetProps<T> = T extends keyof React.JSX.IntrinsicElements
207+
? React.JSX.IntrinsicElements[T]
208+
: T extends AnyComponent
209+
? React.ComponentPropsWithRef<T>
210+
: {};
211+
187212
/**
188213
* Used by PolymorphicComponent to define prop override cascading order.
189214
*/
@@ -193,13 +218,9 @@ export type PolymorphicComponentProps<
193218
AsTarget extends StyledTarget<R> | (BaseProps extends { as?: infer A } ? A : never) | void,
194219
ForwardedAsTarget extends StyledTarget<R> | void,
195220
// props extracted from "as"
196-
AsTargetProps extends BaseObject = AsTarget extends KnownTarget
197-
? React.ComponentPropsWithRef<AsTarget>
198-
: {},
199-
// props extracted from "forwardAs"; note that ref is excluded
200-
ForwardedAsTargetProps extends BaseObject = ForwardedAsTarget extends KnownTarget
201-
? React.ComponentPropsWithRef<ForwardedAsTarget>
202-
: {},
221+
AsTargetProps extends BaseObject = TargetProps<AsTarget>,
222+
// props extracted from "forwardedAs"; note that ref is excluded
223+
ForwardedAsTargetProps extends BaseObject = TargetProps<ForwardedAsTarget>,
203224
> = OverrideStyle<
204225
NoInfer<
205226
FastOmit<
@@ -409,11 +430,9 @@ export interface StyledObject<Props extends BaseObject = BaseObject>
409430

410431
export type CSSProp = Interpolation<any>;
411432

412-
/**
413-
* @deprecated Use the built-in NoInfer from TypeScript 5.4+ directly.
414-
* Kept for backward compatibility.
415-
*/
416-
export type NoInfer<T> = [T][T extends any ? 0 : never];
433+
// Re-export, not a declaration: declaring `NoInfer` here would shadow the
434+
// TypeScript intrinsic within this file and downgrade every reference to it.
435+
export type { NoInfer } from './utils/noInfer';
417436

418437
export type Substitute<A extends BaseObject, B extends BaseObject> = keyof B extends never
419438
? A
@@ -422,8 +441,15 @@ export type Substitute<A extends BaseObject, B extends BaseObject> = keyof B ext
422441
/**
423442
* Makes keys in K optional while keeping all others required.
424443
* Used to make attrs-provided props optional on the final component.
444+
*
445+
* The guard is `[K] extends [never]`, not `keyof K extends never`. `K` is the set
446+
* of attrs-provided keys and is `never` for any component without `.attrs()`,
447+
* which is most of them, but `keyof never` is `string | number | symbol`, so the
448+
* old spelling never short-circuited. Every such component paid an omit plus a
449+
* `Partial<Pick<...>>` that removed and re-added nothing, and carried both in its
450+
* displayed type.
425451
*/
426-
export type MakeAttrsOptional<P extends BaseObject, K extends keyof any> = keyof K extends never
452+
export type MakeAttrsOptional<P extends BaseObject, K extends keyof any> = [K] extends [never]
427453
? P
428454
: FastOmit<P, K & keyof P> & Partial<Pick<P, K & keyof P>>;
429455

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* @deprecated Use the built-in `NoInfer` from TypeScript 5.4+ directly.
3+
*
4+
* Kept for consumers importing it from `styled-components/dist/types`. It lives
5+
* in its own module rather than in `types.ts` because a module-local `NoInfer`
6+
* shadows the TypeScript intrinsic within that module, silently downgrading
7+
* every reference there to this slower deferred form. `types.ts` re-exports the
8+
* name, and a re-export introduces no local binding.
9+
*/
10+
export type NoInfer<T> = [T][T extends any ? 0 : never];
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"count": 100,
3+
"maxInstantiations": 913000,
4+
"maxTypes": 151000
5+
}

0 commit comments

Comments
 (0)