web-component-analyzer
web-component-analyzer copied to clipboard
Optional fields don't include `undefined` in their type.
export class TextField extends HTMLElement {
size?: 'type'|'large';
}
The type is reported as "type": "\"type\" | \"large\""
, but should be "type": "\"type\" | \"large\" | undefined"
.
Is this a problem that you are experiencing when running the CLI or when using the analyzeText
function?
Typescript strips undefined
and null
from the reported type if strictNullChecks
is false, and it seems like I forgot to add it to compiler options when calling analyzeText
:
https://github.com/runem/web-component-analyzer/blob/d8809c255c5f19b3ba63eafbbec7f0af5791a636/src/analyze/analyze-text.ts#L57-L62
Is this still an issue, or did I fix it by adding strictNullChecks
to compiler options for analyzeText
?