-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Description
TypeScript Version: 4.1.2
Search Terms:
Code
import React from 'react';
type Override<T, U> = Omit<T, keyof U> & U;
type BoxProps<T extends keyof JSX.IntrinsicElements = keyof JSX.IntrinsicElements> =
Override<React.ComponentProps<T>, { as: T }>;
export function Box(props: BoxProps) {
const { as: Component, ...rest } = props;
// @ts-expect-error
return <Component {...rest} />;
}
Expected behavior: tsc exits normally
Actual behavior: tsc crashes with stack trace
/node_modules/typescript/lib/tsc.js:87001
throw e;
^
TypeError: Cannot read property 'declarations' of undefined
at addImplementationSuccessElaboration (/node_modules/typescript/lib/tsc.js:57022:116)
at resolveCall (/node_modules/typescript/lib/tsc.js:56947:33)
at resolveJsxOpeningLikeElement (/node_modules/typescript/lib/tsc.js:57576:20)
at resolveSignature (/node_modules/typescript/lib/tsc.js:57597:28)
at getResolvedSignature (/node_modules/typescript/lib/tsc.js:57608:26)
at checkJsxOpeningLikeElementOrOpeningFragment (/node_modules/typescript/lib/tsc.js:55477:27)
at checkJsxSelfClosingElementDeferred (/node_modules/typescript/lib/tsc.js:55058:13)
at checkDeferredNode (/node_modules/typescript/lib/tsc.js:64402:21)
at Map.forEach (<anonymous>)
at checkDeferredNodes (/node_modules/typescript/lib/tsc.js:64373:37)
error Command failed with exit code 1.
Playground Link: Link
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScript