-
Notifications
You must be signed in to change notification settings - Fork 13k
Fix JSX contextual types to not eagerly become apparent, use 2-pass inference for JSX #21383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8cd9d9d
Fix JSX contextual types to not eagerly become apparent
weswigham 0a08644
Apply changes from code review, unify common code
weswigham 7c63c49
Fix jsx children contextual typing
weswigham 122a7e3
Light code review feedback
weswigham 59fc025
Use fillMissingTypeArguments
weswigham c1df4ce
Merge branch 'master' into fix-jsx-contextual-types
weswigham 774aec8
Accept nonliteral jsx child type
weswigham f1c9736
Add test for the fillMissingTypeArguments case
weswigham File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
tests/baselines/reference/checkJsxGenericTagHasCorrectInferences.errors.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
tests/cases/conformance/jsx/file.tsx(13,27): error TS2322: Type '{ initialValues: { x: string; }; nextValues: (a: { x: string; }) => string; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<GenericComponent<{ initialValues: { x: string; }; nextValues: {}; }, { x: string; }>> & { initialValues: { x: string; }; nextValues: {}; } & BaseProps<{ x: string; }> & { children?: ReactNode; }'. | ||
Type '{ initialValues: { x: string; }; nextValues: (a: { x: string; }) => string; }' is not assignable to type 'BaseProps<{ x: string; }>'. | ||
Types of property 'nextValues' are incompatible. | ||
Type '(a: { x: string; }) => string' is not assignable to type '(cur: { x: string; }) => { x: string; }'. | ||
Type 'string' is not assignable to type '{ x: string; }'. | ||
|
||
|
||
==== tests/cases/conformance/jsx/file.tsx (1 errors) ==== | ||
import * as React from "react"; | ||
interface BaseProps<T> { | ||
initialValues: T; | ||
nextValues: (cur: T) => T; | ||
} | ||
declare class GenericComponent<Props = {}, Values = object> extends React.Component<Props & BaseProps<Values>, {}> { | ||
iv: Values; | ||
} | ||
|
||
let a = <GenericComponent initialValues={{ x: "y" }} nextValues={a => a} />; // No error | ||
let b = <GenericComponent initialValues={12} nextValues={a => a} />; // No error - Values should be reinstantiated with `number` (since `object` is a default, not a constraint) | ||
let c = <GenericComponent initialValues={{ x: "y" }} nextValues={a => ({ x: a.x })} />; // No Error | ||
let d = <GenericComponent initialValues={{ x: "y" }} nextValues={a => a.x} />; // Error - `string` is not assignable to `{x: string}` | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS2322: Type '{ initialValues: { x: string; }; nextValues: (a: { x: string; }) => string; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<GenericComponent<{ initialValues: { x: string; }; nextValues: {}; }, { x: string; }>> & { initialValues: { x: string; }; nextValues: {}; } & BaseProps<{ x: string; }> & { children?: ReactNode; }'. | ||
!!! error TS2322: Type '{ initialValues: { x: string; }; nextValues: (a: { x: string; }) => string; }' is not assignable to type 'BaseProps<{ x: string; }>'. | ||
!!! error TS2322: Types of property 'nextValues' are incompatible. | ||
!!! error TS2322: Type '(a: { x: string; }) => string' is not assignable to type '(cur: { x: string; }) => { x: string; }'. | ||
!!! error TS2322: Type 'string' is not assignable to type '{ x: string; }'. |
23 changes: 23 additions & 0 deletions
23
tests/baselines/reference/checkJsxGenericTagHasCorrectInferences.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//// [file.tsx] | ||
import * as React from "react"; | ||
interface BaseProps<T> { | ||
initialValues: T; | ||
nextValues: (cur: T) => T; | ||
} | ||
declare class GenericComponent<Props = {}, Values = object> extends React.Component<Props & BaseProps<Values>, {}> { | ||
iv: Values; | ||
} | ||
|
||
let a = <GenericComponent initialValues={{ x: "y" }} nextValues={a => a} />; // No error | ||
let b = <GenericComponent initialValues={12} nextValues={a => a} />; // No error - Values should be reinstantiated with `number` (since `object` is a default, not a constraint) | ||
let c = <GenericComponent initialValues={{ x: "y" }} nextValues={a => ({ x: a.x })} />; // No Error | ||
let d = <GenericComponent initialValues={{ x: "y" }} nextValues={a => a.x} />; // Error - `string` is not assignable to `{x: string}` | ||
|
||
//// [file.jsx] | ||
"use strict"; | ||
exports.__esModule = true; | ||
var React = require("react"); | ||
var a = <GenericComponent initialValues={{ x: "y" }} nextValues={function (a) { return a; }}/>; // No error | ||
var b = <GenericComponent initialValues={12} nextValues={function (a) { return a; }}/>; // No error - Values should be reinstantiated with `number` (since `object` is a default, not a constraint) | ||
var c = <GenericComponent initialValues={{ x: "y" }} nextValues={function (a) { return ({ x: a.x }); }}/>; // No Error | ||
var d = <GenericComponent initialValues={{ x: "y" }} nextValues={function (a) { return a.x; }}/>; // Error - `string` is not assignable to `{x: string}` |
74 changes: 74 additions & 0 deletions
74
tests/baselines/reference/checkJsxGenericTagHasCorrectInferences.symbols
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
=== tests/cases/conformance/jsx/file.tsx === | ||
import * as React from "react"; | ||
>React : Symbol(React, Decl(file.tsx, 0, 6)) | ||
|
||
interface BaseProps<T> { | ||
>BaseProps : Symbol(BaseProps, Decl(file.tsx, 0, 31)) | ||
>T : Symbol(T, Decl(file.tsx, 1, 20)) | ||
|
||
initialValues: T; | ||
>initialValues : Symbol(BaseProps.initialValues, Decl(file.tsx, 1, 24)) | ||
>T : Symbol(T, Decl(file.tsx, 1, 20)) | ||
|
||
nextValues: (cur: T) => T; | ||
>nextValues : Symbol(BaseProps.nextValues, Decl(file.tsx, 2, 19)) | ||
>cur : Symbol(cur, Decl(file.tsx, 3, 15)) | ||
>T : Symbol(T, Decl(file.tsx, 1, 20)) | ||
>T : Symbol(T, Decl(file.tsx, 1, 20)) | ||
} | ||
declare class GenericComponent<Props = {}, Values = object> extends React.Component<Props & BaseProps<Values>, {}> { | ||
>GenericComponent : Symbol(GenericComponent, Decl(file.tsx, 4, 1)) | ||
>Props : Symbol(Props, Decl(file.tsx, 5, 31)) | ||
>Values : Symbol(Values, Decl(file.tsx, 5, 42)) | ||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66)) | ||
>React : Symbol(React, Decl(file.tsx, 0, 6)) | ||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66)) | ||
>Props : Symbol(Props, Decl(file.tsx, 5, 31)) | ||
>BaseProps : Symbol(BaseProps, Decl(file.tsx, 0, 31)) | ||
>Values : Symbol(Values, Decl(file.tsx, 5, 42)) | ||
|
||
iv: Values; | ||
>iv : Symbol(GenericComponent.iv, Decl(file.tsx, 5, 116)) | ||
>Values : Symbol(Values, Decl(file.tsx, 5, 42)) | ||
} | ||
|
||
let a = <GenericComponent initialValues={{ x: "y" }} nextValues={a => a} />; // No error | ||
>a : Symbol(a, Decl(file.tsx, 9, 3)) | ||
>GenericComponent : Symbol(GenericComponent, Decl(file.tsx, 4, 1)) | ||
>initialValues : Symbol(initialValues, Decl(file.tsx, 9, 25)) | ||
>x : Symbol(x, Decl(file.tsx, 9, 42)) | ||
>nextValues : Symbol(nextValues, Decl(file.tsx, 9, 52)) | ||
>a : Symbol(a, Decl(file.tsx, 9, 65)) | ||
>a : Symbol(a, Decl(file.tsx, 9, 65)) | ||
|
||
let b = <GenericComponent initialValues={12} nextValues={a => a} />; // No error - Values should be reinstantiated with `number` (since `object` is a default, not a constraint) | ||
>b : Symbol(b, Decl(file.tsx, 10, 3)) | ||
>GenericComponent : Symbol(GenericComponent, Decl(file.tsx, 4, 1)) | ||
>initialValues : Symbol(initialValues, Decl(file.tsx, 10, 25)) | ||
>nextValues : Symbol(nextValues, Decl(file.tsx, 10, 44)) | ||
>a : Symbol(a, Decl(file.tsx, 10, 57)) | ||
>a : Symbol(a, Decl(file.tsx, 10, 57)) | ||
|
||
let c = <GenericComponent initialValues={{ x: "y" }} nextValues={a => ({ x: a.x })} />; // No Error | ||
>c : Symbol(c, Decl(file.tsx, 11, 3)) | ||
>GenericComponent : Symbol(GenericComponent, Decl(file.tsx, 4, 1)) | ||
>initialValues : Symbol(initialValues, Decl(file.tsx, 11, 25)) | ||
>x : Symbol(x, Decl(file.tsx, 11, 42)) | ||
>nextValues : Symbol(nextValues, Decl(file.tsx, 11, 52)) | ||
>a : Symbol(a, Decl(file.tsx, 11, 65)) | ||
>x : Symbol(x, Decl(file.tsx, 11, 72)) | ||
>a.x : Symbol(x, Decl(file.tsx, 11, 42)) | ||
>a : Symbol(a, Decl(file.tsx, 11, 65)) | ||
>x : Symbol(x, Decl(file.tsx, 11, 42)) | ||
|
||
let d = <GenericComponent initialValues={{ x: "y" }} nextValues={a => a.x} />; // Error - `string` is not assignable to `{x: string}` | ||
>d : Symbol(d, Decl(file.tsx, 12, 3)) | ||
>GenericComponent : Symbol(GenericComponent, Decl(file.tsx, 4, 1)) | ||
>initialValues : Symbol(initialValues, Decl(file.tsx, 12, 25)) | ||
>x : Symbol(x, Decl(file.tsx, 12, 42)) | ||
>nextValues : Symbol(nextValues, Decl(file.tsx, 12, 52)) | ||
>a : Symbol(a, Decl(file.tsx, 12, 65)) | ||
>a.x : Symbol(x, Decl(file.tsx, 12, 42)) | ||
>a : Symbol(a, Decl(file.tsx, 12, 65)) | ||
>x : Symbol(x, Decl(file.tsx, 12, 42)) | ||
|
91 changes: 91 additions & 0 deletions
91
tests/baselines/reference/checkJsxGenericTagHasCorrectInferences.types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
=== tests/cases/conformance/jsx/file.tsx === | ||
import * as React from "react"; | ||
>React : typeof React | ||
|
||
interface BaseProps<T> { | ||
>BaseProps : BaseProps<T> | ||
>T : T | ||
|
||
initialValues: T; | ||
>initialValues : T | ||
>T : T | ||
|
||
nextValues: (cur: T) => T; | ||
>nextValues : (cur: T) => T | ||
>cur : T | ||
>T : T | ||
>T : T | ||
} | ||
declare class GenericComponent<Props = {}, Values = object> extends React.Component<Props & BaseProps<Values>, {}> { | ||
>GenericComponent : GenericComponent<Props, Values> | ||
>Props : Props | ||
>Values : Values | ||
>React.Component : React.Component<Props & BaseProps<Values>, {}> | ||
>React : typeof React | ||
>Component : typeof React.Component | ||
>Props : Props | ||
>BaseProps : BaseProps<T> | ||
>Values : Values | ||
|
||
iv: Values; | ||
>iv : Values | ||
>Values : Values | ||
} | ||
|
||
let a = <GenericComponent initialValues={{ x: "y" }} nextValues={a => a} />; // No error | ||
>a : JSX.Element | ||
><GenericComponent initialValues={{ x: "y" }} nextValues={a => a} /> : JSX.Element | ||
>GenericComponent : typeof GenericComponent | ||
>initialValues : { x: string; } | ||
>{ x: "y" } : { x: string; } | ||
>x : string | ||
>"y" : "y" | ||
>nextValues : (a: { x: string; }) => { x: string; } | ||
>a => a : (a: { x: string; }) => { x: string; } | ||
>a : { x: string; } | ||
>a : { x: string; } | ||
|
||
let b = <GenericComponent initialValues={12} nextValues={a => a} />; // No error - Values should be reinstantiated with `number` (since `object` is a default, not a constraint) | ||
>b : JSX.Element | ||
><GenericComponent initialValues={12} nextValues={a => a} /> : JSX.Element | ||
>GenericComponent : typeof GenericComponent | ||
>initialValues : number | ||
>12 : 12 | ||
>nextValues : (a: number) => number | ||
>a => a : (a: number) => number | ||
>a : number | ||
>a : number | ||
|
||
let c = <GenericComponent initialValues={{ x: "y" }} nextValues={a => ({ x: a.x })} />; // No Error | ||
>c : JSX.Element | ||
><GenericComponent initialValues={{ x: "y" }} nextValues={a => ({ x: a.x })} /> : JSX.Element | ||
>GenericComponent : typeof GenericComponent | ||
>initialValues : { x: string; } | ||
>{ x: "y" } : { x: string; } | ||
>x : string | ||
>"y" : "y" | ||
>nextValues : (a: { x: string; }) => { x: string; } | ||
>a => ({ x: a.x }) : (a: { x: string; }) => { x: string; } | ||
>a : { x: string; } | ||
>({ x: a.x }) : { x: string; } | ||
>{ x: a.x } : { x: string; } | ||
>x : string | ||
>a.x : string | ||
>a : { x: string; } | ||
>x : string | ||
|
||
let d = <GenericComponent initialValues={{ x: "y" }} nextValues={a => a.x} />; // Error - `string` is not assignable to `{x: string}` | ||
>d : JSX.Element | ||
><GenericComponent initialValues={{ x: "y" }} nextValues={a => a.x} /> : JSX.Element | ||
>GenericComponent : typeof GenericComponent | ||
>initialValues : { x: string; } | ||
>{ x: "y" } : { x: string; } | ||
>x : string | ||
>"y" : "y" | ||
>nextValues : (a: { x: string; }) => string | ||
>a => a.x : (a: { x: string; }) => string | ||
>a : { x: string; } | ||
>a.x : string | ||
>a : { x: string; } | ||
>x : string | ||
|
68 changes: 68 additions & 0 deletions
68
tests/baselines/reference/jsxChildrenGenericContextualTypes.errors.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
tests/cases/compiler/jsxChildrenGenericContextualTypes.tsx(20,22): error TS2322: Type '{ prop: "x"; children: (p: IntrinsicAttributes & LitProps<"x">) => "y"; }' is not assignable to type 'IntrinsicAttributes & LitProps<"x">'. | ||
Type '{ prop: "x"; children: (p: IntrinsicAttributes & LitProps<"x">) => "y"; }' is not assignable to type 'LitProps<"x">'. | ||
Types of property 'children' are incompatible. | ||
Type '(p: IntrinsicAttributes & LitProps<"x">) => "y"' is not assignable to type '(x: LitProps<"x">) => "x"'. | ||
Type '"y"' is not assignable to type '"x"'. | ||
tests/cases/compiler/jsxChildrenGenericContextualTypes.tsx(21,27): error TS2322: Type '{ children: (p: IntrinsicAttributes & LitProps<"x">) => "y"; prop: "x"; }' is not assignable to type 'IntrinsicAttributes & LitProps<"x" | "y">'. | ||
Type '{ children: (p: IntrinsicAttributes & LitProps<"x">) => "y"; prop: "x"; }' is not assignable to type 'LitProps<"x" | "y">'. | ||
Types of property 'children' are incompatible. | ||
Type '(p: IntrinsicAttributes & LitProps<"x">) => "y"' is not assignable to type '(x: LitProps<"x" | "y">) => "x" | "y"'. | ||
Types of parameters 'p' and 'x' are incompatible. | ||
Type 'LitProps<"x" | "y">' is not assignable to type 'IntrinsicAttributes & LitProps<"x">'. | ||
Type 'LitProps<"x" | "y">' is not assignable to type 'LitProps<"x">'. | ||
Types of property 'prop' are incompatible. | ||
Type '"x" | "y"' is not assignable to type '"x"'. | ||
Type '"y"' is not assignable to type '"x"'. | ||
tests/cases/compiler/jsxChildrenGenericContextualTypes.tsx(22,29): error TS2322: Type '{ children: () => number; prop: "x"; }' is not assignable to type 'IntrinsicAttributes & LitProps<"x">'. | ||
Type '{ children: () => number; prop: "x"; }' is not assignable to type 'LitProps<"x">'. | ||
Types of property 'children' are incompatible. | ||
Type '() => number' is not assignable to type '(x: LitProps<"x">) => "x"'. | ||
Type 'number' is not assignable to type '"x"'. | ||
|
||
|
||
==== tests/cases/compiler/jsxChildrenGenericContextualTypes.tsx (3 errors) ==== | ||
namespace JSX { | ||
export interface Element {} | ||
export interface ElementAttributesProperty { props: {}; } | ||
export interface ElementChildrenAttribute { children: {}; } | ||
export interface IntrinsicAttributes {} | ||
export interface IntrinsicElements { [key: string]: Element } | ||
} | ||
const Elem = <T,U=never>(p: { prop: T, children: (t: T) => T }) => <div></div>; | ||
Elem({prop: {a: "x"}, children: i => ({a: "z"})}); | ||
const q = <Elem prop={{a: "x"}} children={i => ({a: "z"})} /> | ||
const qq = <Elem prop={{a: "x"}}>{i => ({a: "z"})}</Elem> | ||
|
||
interface LitProps<T> { prop: T, children: (x: this) => T } | ||
const ElemLit = <T extends string>(p: LitProps<T>) => <div></div>; | ||
ElemLit({prop: "x", children: () => "x"}); | ||
const j = <ElemLit prop="x" children={() => "x"} /> | ||
const jj = <ElemLit prop="x">{() => "x"}</ElemLit> | ||
|
||
// Should error | ||
const arg = <ElemLit prop="x" children={p => "y"} /> | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS2322: Type '{ prop: "x"; children: (p: IntrinsicAttributes & LitProps<"x">) => "y"; }' is not assignable to type 'IntrinsicAttributes & LitProps<"x">'. | ||
!!! error TS2322: Type '{ prop: "x"; children: (p: IntrinsicAttributes & LitProps<"x">) => "y"; }' is not assignable to type 'LitProps<"x">'. | ||
!!! error TS2322: Types of property 'children' are incompatible. | ||
!!! error TS2322: Type '(p: IntrinsicAttributes & LitProps<"x">) => "y"' is not assignable to type '(x: LitProps<"x">) => "x"'. | ||
!!! error TS2322: Type '"y"' is not assignable to type '"x"'. | ||
const argchild = <ElemLit prop="x">{p => "y"}</ElemLit> | ||
~~~~~~~~ | ||
!!! error TS2322: Type '{ children: (p: IntrinsicAttributes & LitProps<"x">) => "y"; prop: "x"; }' is not assignable to type 'IntrinsicAttributes & LitProps<"x" | "y">'. | ||
!!! error TS2322: Type '{ children: (p: IntrinsicAttributes & LitProps<"x">) => "y"; prop: "x"; }' is not assignable to type 'LitProps<"x" | "y">'. | ||
!!! error TS2322: Types of property 'children' are incompatible. | ||
!!! error TS2322: Type '(p: IntrinsicAttributes & LitProps<"x">) => "y"' is not assignable to type '(x: LitProps<"x" | "y">) => "x" | "y"'. | ||
!!! error TS2322: Types of parameters 'p' and 'x' are incompatible. | ||
!!! error TS2322: Type 'LitProps<"x" | "y">' is not assignable to type 'IntrinsicAttributes & LitProps<"x">'. | ||
!!! error TS2322: Type 'LitProps<"x" | "y">' is not assignable to type 'LitProps<"x">'. | ||
!!! error TS2322: Types of property 'prop' are incompatible. | ||
!!! error TS2322: Type '"x" | "y"' is not assignable to type '"x"'. | ||
!!! error TS2322: Type '"y"' is not assignable to type '"x"'. | ||
const mismatched = <ElemLit prop="x">{() => 12}</ElemLit> | ||
~~~~~~~~ | ||
!!! error TS2322: Type '{ children: () => number; prop: "x"; }' is not assignable to type 'IntrinsicAttributes & LitProps<"x">'. | ||
!!! error TS2322: Type '{ children: () => number; prop: "x"; }' is not assignable to type 'LitProps<"x">'. | ||
!!! error TS2322: Types of property 'children' are incompatible. | ||
!!! error TS2322: Type '() => number' is not assignable to type '(x: LitProps<"x">) => "x"'. | ||
!!! error TS2322: Type 'number' is not assignable to type '"x"'. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kind of like 0. It’s pretty succinct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we have
None
for so many other enums - plus, it also clarifies what0
actually does at the callsite to someone reading the code.