diff --git a/tests/baselines/reference/mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.symbols b/tests/baselines/reference/mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.symbols deleted file mode 100644 index c94bc76ef60a3..0000000000000 --- a/tests/baselines/reference/mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.symbols +++ /dev/null @@ -1,39 +0,0 @@ -=== tests/cases/compiler/mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.ts === -interface StateSchema { ->StateSchema : Symbol(StateSchema, Decl(mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.ts, 0, 0)) - - states?: { ->states : Symbol(StateSchema.states, Decl(mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.ts, 0, 23)) - - [key: string]: StateSchema; ->key : Symbol(key, Decl(mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.ts, 2, 5)) ->StateSchema : Symbol(StateSchema, Decl(mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.ts, 0, 0)) - - }; -} - -declare class StateNode { ->StateNode : Symbol(StateNode, Decl(mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.ts, 4, 1)) ->TStateSchema : Symbol(TStateSchema, Decl(mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.ts, 6, 24)) ->StateSchema : Symbol(StateSchema, Decl(mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.ts, 0, 0)) - - schema: TStateSchema; ->schema : Symbol(StateNode.schema, Decl(mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.ts, 6, 59)) ->TStateSchema : Symbol(TStateSchema, Decl(mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.ts, 6, 24)) -} - -type StateNodesConfig = { ->StateNodesConfig : Symbol(StateNodesConfig, Decl(mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.ts, 8, 1)) ->TStateSchema : Symbol(TStateSchema, Decl(mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.ts, 10, 22)) ->StateSchema : Symbol(StateSchema, Decl(mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.ts, 0, 0)) - - [K in keyof TStateSchema["states"]]: StateNode[K]>; ->K : Symbol(K, Decl(mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.ts, 11, 3)) ->TStateSchema : Symbol(TStateSchema, Decl(mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.ts, 10, 22)) ->StateNode : Symbol(StateNode, Decl(mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.ts, 4, 1)) ->NonNullable : Symbol(NonNullable, Decl(lib.es5.d.ts, --, --)) ->TStateSchema : Symbol(TStateSchema, Decl(mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.ts, 10, 22)) ->K : Symbol(K, Decl(mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.ts, 11, 3)) - -}; - diff --git a/tests/baselines/reference/mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.types b/tests/baselines/reference/mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.types deleted file mode 100644 index 324becfe6b1cf..0000000000000 --- a/tests/baselines/reference/mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.types +++ /dev/null @@ -1,24 +0,0 @@ -=== tests/cases/compiler/mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.ts === -interface StateSchema { - states?: { ->states : { [key: string]: StateSchema; } | undefined - - [key: string]: StateSchema; ->key : string - - }; -} - -declare class StateNode { ->StateNode : StateNode - - schema: TStateSchema; ->schema : TStateSchema -} - -type StateNodesConfig = { ->StateNodesConfig : StateNodesConfig - - [K in keyof TStateSchema["states"]]: StateNode[K]>; -}; - diff --git a/tests/baselines/reference/nonNullableWithNullableGenericTypeArg.symbols b/tests/baselines/reference/nonNullableWithNullableGenericTypeArg.symbols new file mode 100644 index 0000000000000..0ee239560c373 --- /dev/null +++ b/tests/baselines/reference/nonNullableWithNullableGenericTypeArg.symbols @@ -0,0 +1,77 @@ +=== tests/cases/compiler/nonNullableWithNullableGenericTypeArg.ts === +// repro from #50539 + +interface StateSchema { +>StateSchema : Symbol(StateSchema, Decl(nonNullableWithNullableGenericTypeArg.ts, 0, 0)) + + states?: { +>states : Symbol(StateSchema.states, Decl(nonNullableWithNullableGenericTypeArg.ts, 2, 23)) + + [key: string]: StateSchema; +>key : Symbol(key, Decl(nonNullableWithNullableGenericTypeArg.ts, 4, 5)) +>StateSchema : Symbol(StateSchema, Decl(nonNullableWithNullableGenericTypeArg.ts, 0, 0)) + + }; +} + +declare class StateNode { +>StateNode : Symbol(StateNode, Decl(nonNullableWithNullableGenericTypeArg.ts, 6, 1)) +>TStateSchema : Symbol(TStateSchema, Decl(nonNullableWithNullableGenericTypeArg.ts, 8, 24)) +>StateSchema : Symbol(StateSchema, Decl(nonNullableWithNullableGenericTypeArg.ts, 0, 0)) + + schema: TStateSchema; +>schema : Symbol(StateNode.schema, Decl(nonNullableWithNullableGenericTypeArg.ts, 8, 59)) +>TStateSchema : Symbol(TStateSchema, Decl(nonNullableWithNullableGenericTypeArg.ts, 8, 24)) +} + +type StateNodesConfig = { +>StateNodesConfig : Symbol(StateNodesConfig, Decl(nonNullableWithNullableGenericTypeArg.ts, 10, 1)) +>TStateSchema : Symbol(TStateSchema, Decl(nonNullableWithNullableGenericTypeArg.ts, 12, 22)) +>StateSchema : Symbol(StateSchema, Decl(nonNullableWithNullableGenericTypeArg.ts, 0, 0)) + + [K in keyof TStateSchema["states"]]: StateNode[K]>; +>K : Symbol(K, Decl(nonNullableWithNullableGenericTypeArg.ts, 13, 3)) +>TStateSchema : Symbol(TStateSchema, Decl(nonNullableWithNullableGenericTypeArg.ts, 12, 22)) +>StateNode : Symbol(StateNode, Decl(nonNullableWithNullableGenericTypeArg.ts, 6, 1)) +>NonNullable : Symbol(NonNullable, Decl(lib.es5.d.ts, --, --)) +>TStateSchema : Symbol(TStateSchema, Decl(nonNullableWithNullableGenericTypeArg.ts, 12, 22)) +>K : Symbol(K, Decl(nonNullableWithNullableGenericTypeArg.ts, 13, 3)) + +}; + +// repro from #50539#issuecomment-1234067835 + +type Ordering = { +>Ordering : Symbol(Ordering, Decl(nonNullableWithNullableGenericTypeArg.ts, 14, 2)) +>TOrderBy : Symbol(TOrderBy, Decl(nonNullableWithNullableGenericTypeArg.ts, 18, 14)) + + orderBy: TOrderBy +>orderBy : Symbol(orderBy, Decl(nonNullableWithNullableGenericTypeArg.ts, 18, 42)) +>TOrderBy : Symbol(TOrderBy, Decl(nonNullableWithNullableGenericTypeArg.ts, 18, 14)) +} + +type Query = { +>Query : Symbol(Query, Decl(nonNullableWithNullableGenericTypeArg.ts, 20, 1)) +>TOrderBy : Symbol(TOrderBy, Decl(nonNullableWithNullableGenericTypeArg.ts, 22, 11)) + + order?: Ordering +>order : Symbol(order, Decl(nonNullableWithNullableGenericTypeArg.ts, 22, 39)) +>Ordering : Symbol(Ordering, Decl(nonNullableWithNullableGenericTypeArg.ts, 14, 2)) +>TOrderBy : Symbol(TOrderBy, Decl(nonNullableWithNullableGenericTypeArg.ts, 22, 11)) +} + +type QueryHandler< +>QueryHandler : Symbol(QueryHandler, Decl(nonNullableWithNullableGenericTypeArg.ts, 24, 1)) + + TQuery extends Query, +>TQuery : Symbol(TQuery, Decl(nonNullableWithNullableGenericTypeArg.ts, 26, 18)) +>Query : Symbol(Query, Decl(nonNullableWithNullableGenericTypeArg.ts, 20, 1)) +>TOrderBy : Symbol(TOrderBy, Decl(nonNullableWithNullableGenericTypeArg.ts, 27, 35)) + + TOrderBy extends string = NonNullable["orderBy"] +>TOrderBy : Symbol(TOrderBy, Decl(nonNullableWithNullableGenericTypeArg.ts, 27, 35)) +>NonNullable : Symbol(NonNullable, Decl(lib.es5.d.ts, --, --)) +>TQuery : Symbol(TQuery, Decl(nonNullableWithNullableGenericTypeArg.ts, 26, 18)) + +> = {} + diff --git a/tests/baselines/reference/nonNullableWithNullableGenericTypeArg.types b/tests/baselines/reference/nonNullableWithNullableGenericTypeArg.types new file mode 100644 index 0000000000000..30c1c1fd220d0 --- /dev/null +++ b/tests/baselines/reference/nonNullableWithNullableGenericTypeArg.types @@ -0,0 +1,49 @@ +=== tests/cases/compiler/nonNullableWithNullableGenericTypeArg.ts === +// repro from #50539 + +interface StateSchema { + states?: { +>states : { [key: string]: StateSchema; } | undefined + + [key: string]: StateSchema; +>key : string + + }; +} + +declare class StateNode { +>StateNode : StateNode + + schema: TStateSchema; +>schema : TStateSchema +} + +type StateNodesConfig = { +>StateNodesConfig : StateNodesConfig + + [K in keyof TStateSchema["states"]]: StateNode[K]>; +}; + +// repro from #50539#issuecomment-1234067835 + +type Ordering = { +>Ordering : Ordering + + orderBy: TOrderBy +>orderBy : TOrderBy +} + +type Query = { +>Query : Query + + order?: Ordering +>order : Ordering | undefined +} + +type QueryHandler< +>QueryHandler : QueryHandler + + TQuery extends Query, + TOrderBy extends string = NonNullable["orderBy"] +> = {} + diff --git a/tests/cases/compiler/mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.ts b/tests/cases/compiler/nonNullableWithNullableGenericTypeArg.ts similarity index 50% rename from tests/cases/compiler/mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.ts rename to tests/cases/compiler/nonNullableWithNullableGenericTypeArg.ts index 025170356f969..8b8d4dc0e24ca 100644 --- a/tests/cases/compiler/mappedTypeOverNullableConstraintWithIndexSignatureWithNonNullable.ts +++ b/tests/cases/compiler/nonNullableWithNullableGenericTypeArg.ts @@ -1,6 +1,8 @@ // @noEmit: true // @strict: true +// repro from #50539 + interface StateSchema { states?: { [key: string]: StateSchema; @@ -14,3 +16,18 @@ declare class StateNode { type StateNodesConfig = { [K in keyof TStateSchema["states"]]: StateNode[K]>; }; + +// repro from #50539#issuecomment-1234067835 + +type Ordering = { + orderBy: TOrderBy +} + +type Query = { + order?: Ordering +} + +type QueryHandler< + TQuery extends Query, + TOrderBy extends string = NonNullable["orderBy"] +> = {}