Skip to content

Rolling out nullness annotations #3887

@kerams

Description

@kerams

.NET 9 is around the corner, and with it support for consuming and emitting nullness metadata in F# projects. JS APIs will often return null/undefined, and while Fable bindings often capture this information by using options, sometimes we give no indication that nulls are a possibility. I think F# 9 will be really useful here, so I'd like to start a discussion about the adoption plan for these annotations.

From the technical point of view, binding projects need to be compiled using .NET 9 SDK, <LangVersion>preview</LangVersion> (for now) and with the --checknulls+ flag (also for now - I think this will be aligned with C#'s <Nullable>enable</Nullable>). TFMs don't matter, so netstandard2.0 assemblies will contain nullness metadata too.

Finally, every API will need to be manually reviewed and annotated as required. In the case of existing bindings that use options with reference types, there's the question of whether we want to preserve options or replace them with null annotations, just so that a single, unified approach is used.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions