TypeScript Version: 3.8.3
Search Terms:
- jsx generic
- jsx unknown
- jsx generic unknown
Expected behavior:
No types in output when jsx is set to preserve.
Actual behavior:
Some types in output, meaning the resulting JSX is invalid.
Related Issues:
Code
import * as React from 'react';
class Test<P> extends React.Component<P> {
render() {
return "Hello"
}
}
type SomeType = {
foo?: boolean
}
interface SomeInterface {
bar?: boolean
}
const usingTest: React.FC = () => {
<>
<Test<{}> />
<Test<SomeType> />
<Test<SomeInterface> />
<Test<unknown> />
<Test<string> />
<Test<boolean> />
<Test<object> />
<Test<null> />
<Test<any> />
<Test<never> />
</>
}
Output
import * as React from 'react';
class Test extends React.Component {
render() {
return "Hello";
}
}
const usingTest = () => {
<>
<Test />
<Test />
<Test />
<Test<unknown> />
<Test />
<Test />
<Test<object> />
<Test<null> />
<Test />
<Test />
</>;
};
Compiler Options
{
"compilerOptions": {
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"strictBindCallApply": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"useDefineForClassFields": false,
"alwaysStrict": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"downlevelIteration": false,
"noEmitHelpers": false,
"noLib": false,
"noStrictGenericChecks": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"esModuleInterop": true,
"preserveConstEnums": false,
"removeComments": false,
"skipLibCheck": false,
"checkJs": false,
"allowJs": false,
"declaration": true,
"experimentalDecorators": false,
"emitDecoratorMetadata": false,
"target": "ES2017",
"module": "ESNext",
"jsx": "preserve"
}
}
Playground Link: Provided
TypeScript Version: 3.8.3
Search Terms:
Expected behavior:
No types in output when
jsxis set topreserve.Actual behavior:
Some types in output, meaning the resulting JSX is invalid.
Related Issues:
Code
Output
Compiler Options
{ "compilerOptions": { "noImplicitAny": true, "strictNullChecks": true, "strictFunctionTypes": true, "strictPropertyInitialization": true, "strictBindCallApply": true, "noImplicitThis": true, "noImplicitReturns": true, "useDefineForClassFields": false, "alwaysStrict": true, "allowUnreachableCode": false, "allowUnusedLabels": false, "downlevelIteration": false, "noEmitHelpers": false, "noLib": false, "noStrictGenericChecks": false, "noUnusedLocals": false, "noUnusedParameters": false, "esModuleInterop": true, "preserveConstEnums": false, "removeComments": false, "skipLibCheck": false, "checkJs": false, "allowJs": false, "declaration": true, "experimentalDecorators": false, "emitDecoratorMetadata": false, "target": "ES2017", "module": "ESNext", "jsx": "preserve" } }Playground Link: Provided