Closed
Description
TypeScript Version: 3.3.0-dev.20181208
Search Terms:
- 'React' is referenced directly or indirectly in its own type annotation.
- Error: Debug Failure. Invalid cast. The supplied value [object Object] did not pass the test 'isJsonSourceFile'.
Code
// @strict: true
// @module: esnext
// @moduleResolution: node
// @target: es2018
// @filename: global.d.ts
declare global {
const React: typeof import("./module");
}
export {};
// @filename: module.d.ts
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/e95e11dcf2afe422e9044bbdb0e926b1647fbf9e/types/react/index.d.ts#L44-L47
export = React;
export as namespace React;
declare namespace React {
function createRef(): any;
}
// @filename: some_module.ts
export {};
React.createRef;
// @filename: emits.ts
console.log("hello");
React.createRef;
Expected behavior:
compiled without error.([email protected]
)
Actual behavior:
crashes in [email protected]
(issue: #28762) (#28782 fixed)
compiles error in [email protected]
'React' is referenced directly or indirectly in its own type annotation.
Playground Link:
minimal example: https://gist.github.com/magic-akari/cfc0e1c31ddcc5dd4a2f07a5da4725dc
example with @types/react
: https://gist.github.com/magic-akari/aa10dfb809268eb4f63d5749d113a93a
Related Issues:
#28762