Bug Report Checklist
Expected
In this snippet
if (tsapiutils.isBooleanLiteralType(type)) {
assert(typeof type.value === 'boolean');
}
I expect the assertion to pass.
Actual
It fails; there is no .value field in the TS type, so the type is undefined.
Additional Info
The type is defined like so:
|
/** |
|
* A boolean literal. |
|
* i.e. Either a "true" or "false" literal. |
|
* @category Type Types |
|
*/ |
|
export interface BooleanLiteralType extends UnknownLiteralType { |
|
intrinsicName: "false" | "true"; |
|
value: boolean; |
|
} |
typescript-eslint playground link where you can see .value isn't there.
Workaround in use case in typescript-eslint:
https://github.com/typescript-eslint/typescript-eslint/blob/07a6e23f489be8908ff690885343378398012130/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts#L66-L88
Bug Report Checklist
mainbranch of the repository.Expected
In this snippet
I expect the assertion to pass.
Actual
It fails; there is no
.valuefield in the TS type, so the type isundefined.Additional Info
The type is defined like so:
ts-api-utils/src/types/typeGuards/literal.ts
Lines 6 to 14 in 8c74729
typescript-eslint playground link where you can see
.valueisn't there.Workaround in use case in typescript-eslint:
https://github.com/typescript-eslint/typescript-eslint/blob/07a6e23f489be8908ff690885343378398012130/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts#L66-L88