Skip to content

Strict in TypeScript results in numerous errors #7889

@thatblindgeye

Description

@thatblindgeye

Describe the problem
Based off of #7553

When removing "strictNullChecks": false from the tsconfig.base.json file, roughly 1662 errors occur when trying to build (not all from react-core). For now this issue is meant to just keep this on the radar and to eventually decide how best to go about resolving errors (if they need to be).

Some of errors that I noticed are (some are more common than others in what I've seen thus far):

  • A default prop being given a value of null and throwing Type 'null' is not assignable to type...
  • Argument of type X is not assignable to parameter of type...
  • the OUIA methods (getOUIAProps, useOUIAId, etc) throw the above when trying to pass in component.displayName
  • No overload matches this call
  • Cannot invoke an object which is possibly 'undefined' (this.props.onChange when onChange is optional) or Object is possibly undefined
  • Conversion of type X is not assignable to type Y (AboutModal's appendTo: null as HTMLElement for example)
  • JSX Element type X does not have any construct or call signatures
  • Instances where aria attributes are being passed values using || or ternary with null as an option cause type X is not assignable to type Y errors to get thrown. For example in AlertGroupInline: aria-live={isLiveRegion ? 'polite' : null}
  • Type 'undefined' cannot be used as an index type e.g. Avatar has styles.modifiers[size]
  • Property X does not exist on type 'never'

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions