Skip to content

The error "Object is possibly null or undefined" is ambiguous.#49797

Merged
sandersn merged 14 commits intomicrosoft:mainfrom
norech:norech/issue_8274
Sep 15, 2022
Merged

The error "Object is possibly null or undefined" is ambiguous.#49797
sandersn merged 14 commits intomicrosoft:mainfrom
norech:norech/issue_8274

Conversation

@norech
Copy link
Copy Markdown
Contributor

@norech norech commented Jul 6, 2022

This pull request attempts to fix the issue #8274.

The changes made to the diagnostic messages are the following:

When an entity name is found and its total length is shorter than 100 characters, the error messages are replaced with a more explicit equivalent using this entity name.

  • TS2531: Object is possibly 'null'. => TS18047: '{0}' is possibly 'null'.
  • TS2532: Object is possibly 'undefined'. => TS18048: '{0}' is possibly 'undefined'.
  • TS2533: Object is possibly 'null' or 'undefined'. => TS18049: '{0}' is possibly 'null' or 'undefined'.
  • TS2571: Object is of type 'unknown'. => TS18046: '{0}' is of type 'unknown'.

In cases which were previously handled by TS2531, TS2532, or TS2533, if the value is explicitly either null or undefined:

  • TS18050: The value '{0}' cannot be used here.

Baseline have been updated in order to reflect the changes.

Comments, changes and advice are welcome.

Fixes #8274.

(Note: Updated on September 27th, 2022, for a better overview of the changes)

Loading
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Backlog Bug PRs that fix a backlog bug lib update PR modifies files in the `lib` folder

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

The error "Object is possibly null or undefined" is ambiguous.

4 participants