Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9130,7 +9130,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
return false;
}
if ((isPropertySignature(annotatedDeclaration) || isPropertyDeclaration(annotatedDeclaration)) && annotatedDeclaration.questionToken) {
return getTypeWithFacts(type, TypeFacts.NEUndefined) === typeFromTypeNode;
// When `exactOptionalPropertyTypes` is enabled we interpret optional properties as written,
// so reusing the existing annotation even if it doesn't include `undefined` is fine.
// When it's disabled, optional properties implicitly include `undefined`, so the annotation
// without `| undefined` must *not* be treated as equivalent.
return exactOptionalPropertyTypes ? getTypeWithFacts(type, TypeFacts.NEUndefined) === typeFromTypeNode : false;
}
if (isParameter(annotatedDeclaration) && hasEffectiveQuestionToken(annotatedDeclaration)) {
return getTypeWithFacts(type, TypeFacts.NEUndefined) === typeFromTypeNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
function foo(x: { id: number; name?: string; }): void;
>foo : (x: { id: number; name?: string; }) => void
> : ^ ^^ ^^^^^
>x : { id: number; name?: string; }
> : ^^^^^^ ^^^^^^^^^ ^^^
>x : { id: number; name?: string | undefined; }
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>id : number
> : ^^^^^^
>name : string | undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

=== assignmentToInstantiationExpression.ts ===
let obj: { fn?: <T>() => T } = {};
>obj : { fn?: <T>() => T; }
> : ^^^^^^^ ^^^
>obj : { fn?: (<T>() => T) | undefined; }
> : ^^^^^^^^^ ^^^^^^^ ^^^^^^^^^^^^^^^^
>fn : (<T>() => T) | undefined
> : ^^ ^^^^^^^ ^^^^^^^^^^^^^
>{} : {}
Expand All @@ -16,8 +16,8 @@ obj.fn<number> = () => 1234;
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^
>obj.fn : (<T>() => T) | undefined
> : ^^ ^^^^^^^ ^^^^^^^^^^^^^
>obj : { fn?: <T>() => T; }
> : ^^^^^^^ ^^^
>obj : { fn?: (<T>() => T) | undefined; }
> : ^^^^^^^^^ ^^^^^^^ ^^^^^^^^^^^^^^^^
>fn : (<T>() => T) | undefined
> : ^^ ^^^^^^^ ^^^^^^^^^^^^^
>() => 1234 : () => number
Expand Down
16 changes: 8 additions & 8 deletions tests/baselines/reference/assignmentTypeNarrowing.types
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ type AOrArrA<T> = T | T[];
> : ^^^^^^^^^^

const arr: AOrArrA<{x?: "ok"}> = [{ x: "ok" }]; // weak type
>arr : AOrArrA<{ x?: "ok"; }>
> : ^^^^^^^^^^^^^^ ^^^^
>arr : AOrArrA<{ x?: "ok" | undefined; }>
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>x : "ok" | undefined
> : ^^^^^^^^^^^^^^^^
>[{ x: "ok" }] : { x: "ok"; }[]
Expand All @@ -181,12 +181,12 @@ const arr: AOrArrA<{x?: "ok"}> = [{ x: "ok" }]; // weak type
arr.push({ x: "ok" });
>arr.push({ x: "ok" }) : number
> : ^^^^^^
>arr.push : (...items: { x?: "ok"; }[]) => number
> : ^^^^ ^^^^^^^^ ^^^^^^^^^^
>arr : { x?: "ok"; }[]
> : ^^^^^^ ^^^^^
>push : (...items: { x?: "ok"; }[]) => number
> : ^^^^ ^^^^^^^^ ^^^^^^^^^^
>arr.push : (...items: { x?: "ok" | undefined; }[]) => number
> : ^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>arr : { x?: "ok" | undefined; }[]
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^
>push : (...items: { x?: "ok" | undefined; }[]) => number
> : ^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>{ x: "ok" } : { x: "ok"; }
> : ^^^^^^^^^^^^
>x : "ok"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ declare const foo: ["a", string, number] | ["b", string, boolean];
export function test(arg: { index?: number }) {
>test : (arg: { index?: number; }) => void
> : ^ ^^ ^^^^^^^^^
>arg : { index?: number; }
> : ^^^^^^^^^^ ^^^
>arg : { index?: number | undefined; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>index : number | undefined
> : ^^^^^^^^^^^^^^^^^^

Expand All @@ -18,8 +18,8 @@ export function test(arg: { index?: number }) {
> : ^^^^^^
>0 : 0
> : ^
>arg : { index?: number; }
> : ^^^^^^^^^^ ^^^
>arg : { index?: number | undefined; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

if (foo[index] === "a") {
>foo[index] === "a" : boolean
Expand Down
16 changes: 8 additions & 8 deletions tests/baselines/reference/checkJsxChildrenProperty12.types
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ class Button extends React.Component<ButtonProp, any> {
> : ^^^^^^^^^^^
>InnerButton : typeof InnerButton
> : ^^^^^^^^^^^^^^^^^^
>this.props : ButtonProp & { children?: React.ReactNode; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>this.props : ButtonProp & { children?: React.ReactNode | undefined; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>this : this
> : ^^^^
>props : ButtonProp & { children?: React.ReactNode; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>props : ButtonProp & { children?: React.ReactNode | undefined; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
}
else {
return (<InnerButton {...this.props} >
Expand All @@ -63,12 +63,12 @@ class Button extends React.Component<ButtonProp, any> {
> : ^^^^^^^^^^^
>InnerButton : typeof InnerButton
> : ^^^^^^^^^^^^^^^^^^
>this.props : ButtonProp & { children?: React.ReactNode; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>this.props : ButtonProp & { children?: React.ReactNode | undefined; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>this : this
> : ^^^^
>props : ButtonProp & { children?: React.ReactNode; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>props : ButtonProp & { children?: React.ReactNode | undefined; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

<div>Hello World</div>
><div>Hello World</div> : JSX.Element
Expand Down
8 changes: 4 additions & 4 deletions tests/baselines/reference/checkJsxChildrenProperty13.types
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ class Button extends React.Component<ButtonProp, any> {
> : ^^^^^^^^^^^
>InnerButton : typeof InnerButton
> : ^^^^^^^^^^^^^^^^^^
>this.props : ButtonProp & { children?: React.ReactNode; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>this.props : ButtonProp & { children?: React.ReactNode | undefined; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>this : this
> : ^^^^
>props : ButtonProp & { children?: React.ReactNode; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>props : ButtonProp & { children?: React.ReactNode | undefined; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>children : string
> : ^^^^^^

Expand Down
8 changes: 4 additions & 4 deletions tests/baselines/reference/checkJsxChildrenProperty3.types
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ class FetchUser extends React.Component<IFetchUserProps, any> {
> : ^^^^^^^^^^^
>this.props.children : ((user: IUser) => JSX.Element) & (React.ReactNode | undefined)
> : ^^ ^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>this.props : IFetchUserProps & { children?: React.ReactNode; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>this.props : IFetchUserProps & { children?: React.ReactNode | undefined; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>this : this
> : ^^^^
>props : IFetchUserProps & { children?: React.ReactNode; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>props : IFetchUserProps & { children?: React.ReactNode | undefined; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>children : ((user: IUser) => JSX.Element) & (React.ReactNode | undefined)
> : ^^ ^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>this.state.result : any
Expand Down
8 changes: 4 additions & 4 deletions tests/baselines/reference/checkJsxChildrenProperty4.types
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ class FetchUser extends React.Component<IFetchUserProps, any> {
> : ^^^^^^^^^^^
>this.props.children : ((user: IUser) => JSX.Element) & (React.ReactNode | undefined)
> : ^^ ^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>this.props : IFetchUserProps & { children?: React.ReactNode; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>this.props : IFetchUserProps & { children?: React.ReactNode | undefined; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>this : this
> : ^^^^
>props : IFetchUserProps & { children?: React.ReactNode; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>props : IFetchUserProps & { children?: React.ReactNode | undefined; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>children : ((user: IUser) => JSX.Element) & (React.ReactNode | undefined)
> : ^^ ^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>this.state.result : any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ declare class Component<P> {
class C<T> extends Component<{ x?: boolean; } & T> {}
>C : C<T>
> : ^^^^
>Component : Component<{ x?: boolean; } & T>
> : ^^^^^^^^^^^^^^^^ ^^^^^^^^
>Component : Component<{ x?: boolean | undefined; } & T>
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>x : boolean | undefined
> : ^^^^^^^^^^^^^^^^^^^

Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/classIsSubtypeOfBaseType.types
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class Derived2 extends Base<{ bar: string; }> {
> : ^^^^^^

foo: {
>foo : { bar?: string; }
> : ^^^^^^^^ ^^^
>foo : { bar?: string | undefined; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

bar?: string; // error
>bar : string | undefined
Expand Down
24 changes: 12 additions & 12 deletions tests/baselines/reference/commonTypeIntersection.types
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@

=== commonTypeIntersection.ts ===
declare let x1: { __typename?: 'TypeTwo' } & { a: boolean };
>x1 : { __typename?: "TypeTwo"; } & { a: boolean; }
> : ^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^
>x1 : { __typename?: "TypeTwo" | undefined; } & { a: boolean; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^
>__typename : "TypeTwo" | undefined
> : ^^^^^^^^^^^^^^^^^^^^^
>a : boolean
> : ^^^^^^^

let y1: { __typename?: 'TypeOne' } & { a: boolean} = x1; // should error here
>y1 : { __typename?: "TypeOne"; } & { a: boolean; }
> : ^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^
>y1 : { __typename?: "TypeOne" | undefined; } & { a: boolean; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^
>__typename : "TypeOne" | undefined
> : ^^^^^^^^^^^^^^^^^^^^^
>a : boolean
> : ^^^^^^^
>x1 : { __typename?: "TypeTwo"; } & { a: boolean; }
> : ^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^
>x1 : { __typename?: "TypeTwo" | undefined; } & { a: boolean; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^

declare let x2: { __typename?: 'TypeTwo' } & string;
>x2 : { __typename?: "TypeTwo"; } & string
> : ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^
>x2 : { __typename?: "TypeTwo" | undefined; } & string
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>__typename : "TypeTwo" | undefined
> : ^^^^^^^^^^^^^^^^^^^^^

let y2: { __typename?: 'TypeOne' } & string = x2; // should error here
>y2 : { __typename?: "TypeOne"; } & string
> : ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^
>y2 : { __typename?: "TypeOne" | undefined; } & string
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>__typename : "TypeOne" | undefined
> : ^^^^^^^^^^^^^^^^^^^^^
>x2 : { __typename?: "TypeTwo"; } & string
> : ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^
>x2 : { __typename?: "TypeTwo" | undefined; } & string
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ declare function createMachine<
TTypesMeta extends TypegenEnabled | TypegenDisabled = TypegenDisabled
>(
config: {
>config : { types?: TTypesMeta; }
> : ^^^^^^^^^^ ^^^
>config : { types?: TTypesMeta | undefined; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

types?: TTypesMeta;
>types : TTypesMeta | undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ type IntrinsicElements = {
> : ^^^^^^^^^^^^^^^^^

a: {
>a : { href?: string; }
> : ^^^^^^^^^ ^^^
>a : { href?: string | undefined; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

href?: string;
>href : string | undefined
> : ^^^^^^^^^^^^^^^^^^

};
div: {
>div : { dir?: string; }
> : ^^^^^^^^ ^^^
>div : { dir?: string | undefined; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

dir?: string;
>dir : string | undefined
Expand Down Expand Up @@ -61,28 +61,28 @@ MyMDXComponent({
> : ^^^^
>MyMDXComponent : (props: MDXProps) => null
> : ^ ^^ ^^^^^
>{ components: { a(props) { return null; }, div(props) { return null; }, },} : { components: { a(props: { href?: string; }): null; div(props: { dir?: string; }): null; }; }
> : ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^
>{ components: { a(props) { return null; }, div(props) { return null; }, },} : { components: { a(props: { href?: string | undefined; }): null; div(props: { dir?: string | undefined; }): null; }; }
> : ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

components: {
>components : { a(props: { href?: string; }): null; div(props: { dir?: string; }): null; }
> : ^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^
>{ a(props) { return null; }, div(props) { return null; }, } : { a(props: { href?: string; }): null; div(props: { dir?: string; }): null; }
> : ^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^
>components : { a(props: { href?: string | undefined; }): null; div(props: { dir?: string | undefined; }): null; }
> : ^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>{ a(props) { return null; }, div(props) { return null; }, } : { a(props: { href?: string | undefined; }): null; div(props: { dir?: string | undefined; }): null; }
> : ^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

a(props) {
>a : (props: { href?: string; }) => null
> : ^ ^^^^^^^^^^^ ^^^^^^^^^^^^
>props : { href?: string; }
> : ^^^^^^^^^ ^^^
>a : (props: { href?: string | undefined; }) => null
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>props : { href?: string | undefined; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

return null;
},
div(props) {
>div : (props: { dir?: string; }) => null
> : ^ ^^^^^^^^^^ ^^^^^^^^^^^^
>props : { dir?: string; }
> : ^^^^^^^^ ^^^
>div : (props: { dir?: string | undefined; }) => null
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>props : { dir?: string | undefined; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

return null;
},
Expand Down
16 changes: 8 additions & 8 deletions tests/baselines/reference/contextualTypeFromJSDoc.types
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
=== index.js ===
/** @type {Array<[string, {x?:number, y?:number}]>} */
const arr = [
>arr : [string, { x?: number; y?: number; }][]
> : ^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^
>arr : [string, { x?: number | undefined; y?: number | undefined; }][]
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>[ ['a', { x: 1 }], ['b', { y: 2 }]] : ([string, { x: number; }] | [string, { y: number; }])[]
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down Expand Up @@ -76,14 +76,14 @@ class C {

/** @param {Array<[string, {x?:number, y?:number}]>} value */
set x(value) { }
>x : [string, { x?: number; y?: number; }][]
> : ^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^
>value : [string, { x?: number; y?: number; }][]
> : ^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^
>x : [string, { x?: number | undefined; y?: number | undefined; }][]
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>value : [string, { x?: number | undefined; y?: number | undefined; }][]
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

get x() {
>x : [string, { x?: number; y?: number; }][]
> : ^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^
>x : [string, { x?: number | undefined; y?: number | undefined; }][]
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

return [
>[ ['a', { x: 1 }], ['b', { y: 2 }] ] : ([string, { x: number; }] | [string, { y: number; }])[]
Expand Down
8 changes: 4 additions & 4 deletions tests/baselines/reference/contextuallyTypedJsxAttribute.types
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
=== index.tsx ===
interface Elements {
foo: { callback?: (value: number) => void };
>foo : { callback?: (value: number) => void; }
> : ^^^^^^^^^^^^^ ^^^
>foo : { callback?: ((value: number) => void) | undefined; }
> : ^^^^^^^^^^^^^^^ ^^ ^^^^^ ^^^^^^^^^^^^^^^^
>callback : ((value: number) => void) | undefined
> : ^^ ^^ ^^^^^ ^^^^^^^^^^^^^
>value : number
> : ^^^^^^

bar: { callback?: (value: string) => void };
>bar : { callback?: (value: string) => void; }
> : ^^^^^^^^^^^^^ ^^^
>bar : { callback?: ((value: string) => void) | undefined; }
> : ^^^^^^^^^^^^^^^ ^^ ^^^^^ ^^^^^^^^^^^^^^^^
>callback : ((value: string) => void) | undefined
> : ^^ ^^ ^^^^^ ^^^^^^^^^^^^^
>value : string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ function UnwrappedLink2<T extends ElementType = ElementType>(
> : ^ ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^

props: Omit<ComponentPropsWithRef<ElementType extends T ? "a" : T>, "as"> & {
>props : Omit<React.ComponentPropsWithRef<React.ElementType extends T ? "a" : T>, "as"> & { as?: T; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^
>props : Omit<React.ComponentPropsWithRef<React.ElementType extends T ? "a" : T>, "as"> & { as?: T | undefined; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

as?: T;
>as : T | undefined
Expand Down
Loading