TypeScript Version: 3.8.3
Search Terms: return type true false instead of boolean
Expected behavior: Template should resolved to a () => boolean function
Actual behavior: Template resolved to (() => true) | (() => false)
Related Issues:
Code
type Func<T> = T extends never ? never : (() => T);
const foo: Func<boolean> = Boolean;
// Type 'BooleanConstructor' is not assignable to type '(() => false) | (() => true)'.
// Type 'BooleanConstructor' is not assignable to type '() => false'.
// Type 'boolean' is not assignable to type 'false'.(2322)
Output
"use strict";
const foo = Boolean;
Compiler Options
{
"compilerOptions": {
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"strictBindCallApply": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"alwaysStrict": true,
"esModuleInterop": true,
"declaration": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"moduleResolution": 2,
"target": "ES2017",
"jsx": "React",
"module": "ESNext"
}
}
Playground Link: Provided
TypeScript Version: 3.8.3
Search Terms: return type true false instead of boolean
Expected behavior: Template should resolved to a
() => booleanfunctionActual behavior: Template resolved to
(() => true) | (() => false)Related Issues:
Code
Output
Compiler Options
{ "compilerOptions": { "noImplicitAny": true, "strictNullChecks": true, "strictFunctionTypes": true, "strictPropertyInitialization": true, "strictBindCallApply": true, "noImplicitThis": true, "noImplicitReturns": true, "alwaysStrict": true, "esModuleInterop": true, "declaration": true, "experimentalDecorators": true, "emitDecoratorMetadata": true, "moduleResolution": 2, "target": "ES2017", "jsx": "React", "module": "ESNext" } }Playground Link: Provided