FG
💻 Software🌐 Web & Full-StackMicrosoft

Suggestion: non-nullable type

Freshalmost 10 years ago
Mar 14, 20260 views
Confidence Score87%
87%

Problem

Introduce two new syntax for type declaration based on JSDoc [code block] by default type are nullable. Two new compiler flag : - `inferNonNullableType` make the compiler infer non-nullable type : [code block] - `nonNullableTypeByDefault` (I guess there might be a better name) : [code block]

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Moderate Confidence Fix
84% confidence100% success rate2 verificationsLast verified Mar 14, 2026

Solution: Suggestion: non-nullable type

Low Risk

Personally, I just wrote a little `Maybe<T>` interface and use discipline to ensure that variables of that type are never null.

84

Trust Score

2 verifications

100% success
  1. 1

    Personally, I just wrote a little `Maybe<T>` interface and use discipline to ens

    Personally, I just wrote a little `Maybe<T>` interface and use discipline to ensure that variables of that type are never null.

Validation

Resolved in microsoft/TypeScript GitHub issue #185. Community reactions: 1 upvotes.

Verification Summary

Worked: 2
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

typescriptcompilersuggestionfixedcommitted