common icon indicating copy to clipboard operation
common copied to clipboard

Stricter TS config

Open vincent-psarga opened this issue 4 years ago • 4 comments

Summary

The current TS config does not raise any error when a function is declared as returning a specific type but still returns null or undefined.

This may lead to misunderstanding of the functions when relying on the signature.

Expected Behavior

Considering the following code

function doThings(): boolean {
  if (someSpecificCondition) { return null }

  // some more code here
  return true
}

Get a linter error when running make as

Current Behavior

The previous example may compile without any warning.

vincent-psarga avatar Aug 05 '20 09:08 vincent-psarga

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week if no further activity occurs.

stale[bot] avatar Oct 04 '20 09:10 stale[bot]

Lat’s give this priority - ilhaving stricter type checking might reduce bugs.

aslakhellesoy avatar Oct 04 '20 14:10 aslakhellesoy

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week if no further activity occurs.

stale[bot] avatar Dec 15 '20 21:12 stale[bot]

Reevant article: https://www.figma.com/blog/inside-figma-a-case-study-on-strict-null-checks/

aslakhellesoy avatar Dec 18 '20 15:12 aslakhellesoy

@davidjgoss should this be closed and relevant issue(s), raised on the constituent repos if needed?

luke-hill avatar Jan 08 '24 13:01 luke-hill