common
common copied to clipboard
Stricter TS config
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.
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.
Lat’s give this priority - ilhaving stricter type checking might reduce bugs.
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.
Reevant article: https://www.figma.com/blog/inside-figma-a-case-study-on-strict-null-checks/
@davidjgoss should this be closed and relevant issue(s), raised on the constituent repos if needed?