mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Add an additional test case
This commit is contained in:
-39
@@ -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<TStateSchema extends StateSchema> {
|
||||
>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<TStateSchema extends StateSchema> = {
|
||||
>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<NonNullable<TStateSchema["states"]>[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))
|
||||
|
||||
};
|
||||
|
||||
-24
@@ -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<TStateSchema extends StateSchema> {
|
||||
>StateNode : StateNode<TStateSchema>
|
||||
|
||||
schema: TStateSchema;
|
||||
>schema : TStateSchema
|
||||
}
|
||||
|
||||
type StateNodesConfig<TStateSchema extends StateSchema> = {
|
||||
>StateNodesConfig : StateNodesConfig<TStateSchema>
|
||||
|
||||
[K in keyof TStateSchema["states"]]: StateNode<NonNullable<TStateSchema["states"]>[K]>;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
=== tests/cases/compiler/nonNullableWithNullableGenericIndexedAccessArg.ts ===
|
||||
// repro from #50539
|
||||
|
||||
interface StateSchema {
|
||||
>StateSchema : Symbol(StateSchema, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 0, 0))
|
||||
|
||||
states?: {
|
||||
>states : Symbol(StateSchema.states, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 2, 23))
|
||||
|
||||
[key: string]: StateSchema;
|
||||
>key : Symbol(key, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 4, 5))
|
||||
>StateSchema : Symbol(StateSchema, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 0, 0))
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
declare class StateNode<TStateSchema extends StateSchema> {
|
||||
>StateNode : Symbol(StateNode, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 6, 1))
|
||||
>TStateSchema : Symbol(TStateSchema, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 8, 24))
|
||||
>StateSchema : Symbol(StateSchema, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 0, 0))
|
||||
|
||||
schema: TStateSchema;
|
||||
>schema : Symbol(StateNode.schema, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 8, 59))
|
||||
>TStateSchema : Symbol(TStateSchema, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 8, 24))
|
||||
}
|
||||
|
||||
type StateNodesConfig<TStateSchema extends StateSchema> = {
|
||||
>StateNodesConfig : Symbol(StateNodesConfig, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 10, 1))
|
||||
>TStateSchema : Symbol(TStateSchema, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 12, 22))
|
||||
>StateSchema : Symbol(StateSchema, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 0, 0))
|
||||
|
||||
[K in keyof TStateSchema["states"]]: StateNode<NonNullable<TStateSchema["states"]>[K]>;
|
||||
>K : Symbol(K, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 13, 3))
|
||||
>TStateSchema : Symbol(TStateSchema, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 12, 22))
|
||||
>StateNode : Symbol(StateNode, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 6, 1))
|
||||
>NonNullable : Symbol(NonNullable, Decl(lib.es5.d.ts, --, --))
|
||||
>TStateSchema : Symbol(TStateSchema, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 12, 22))
|
||||
>K : Symbol(K, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 13, 3))
|
||||
|
||||
};
|
||||
|
||||
// repro from #50539#issuecomment-1234067835
|
||||
|
||||
type Ordering<TOrderBy extends string> = {
|
||||
>Ordering : Symbol(Ordering, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 14, 2))
|
||||
>TOrderBy : Symbol(TOrderBy, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 18, 14))
|
||||
|
||||
orderBy: TOrderBy
|
||||
>orderBy : Symbol(orderBy, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 18, 42))
|
||||
>TOrderBy : Symbol(TOrderBy, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 18, 14))
|
||||
}
|
||||
|
||||
type Query<TOrderBy extends string> = {
|
||||
>Query : Symbol(Query, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 20, 1))
|
||||
>TOrderBy : Symbol(TOrderBy, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 22, 11))
|
||||
|
||||
order?: Ordering<TOrderBy>
|
||||
>order : Symbol(order, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 22, 39))
|
||||
>Ordering : Symbol(Ordering, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 14, 2))
|
||||
>TOrderBy : Symbol(TOrderBy, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 22, 11))
|
||||
}
|
||||
|
||||
type QueryHandler<
|
||||
>QueryHandler : Symbol(QueryHandler, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 24, 1))
|
||||
|
||||
TQuery extends Query<TOrderBy>,
|
||||
>TQuery : Symbol(TQuery, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 26, 18))
|
||||
>Query : Symbol(Query, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 20, 1))
|
||||
>TOrderBy : Symbol(TOrderBy, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 27, 35))
|
||||
|
||||
TOrderBy extends string = NonNullable<TQuery["order"]>["orderBy"]
|
||||
>TOrderBy : Symbol(TOrderBy, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 27, 35))
|
||||
>NonNullable : Symbol(NonNullable, Decl(lib.es5.d.ts, --, --))
|
||||
>TQuery : Symbol(TQuery, Decl(nonNullableWithNullableGenericIndexedAccessArg.ts, 26, 18))
|
||||
|
||||
> = {}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
=== tests/cases/compiler/nonNullableWithNullableGenericIndexedAccessArg.ts ===
|
||||
// repro from #50539
|
||||
|
||||
interface StateSchema {
|
||||
states?: {
|
||||
>states : { [key: string]: StateSchema; } | undefined
|
||||
|
||||
[key: string]: StateSchema;
|
||||
>key : string
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
declare class StateNode<TStateSchema extends StateSchema> {
|
||||
>StateNode : StateNode<TStateSchema>
|
||||
|
||||
schema: TStateSchema;
|
||||
>schema : TStateSchema
|
||||
}
|
||||
|
||||
type StateNodesConfig<TStateSchema extends StateSchema> = {
|
||||
>StateNodesConfig : StateNodesConfig<TStateSchema>
|
||||
|
||||
[K in keyof TStateSchema["states"]]: StateNode<NonNullable<TStateSchema["states"]>[K]>;
|
||||
};
|
||||
|
||||
// repro from #50539#issuecomment-1234067835
|
||||
|
||||
type Ordering<TOrderBy extends string> = {
|
||||
>Ordering : Ordering<TOrderBy>
|
||||
|
||||
orderBy: TOrderBy
|
||||
>orderBy : TOrderBy
|
||||
}
|
||||
|
||||
type Query<TOrderBy extends string> = {
|
||||
>Query : Query<TOrderBy>
|
||||
|
||||
order?: Ordering<TOrderBy>
|
||||
>order : Ordering<TOrderBy> | undefined
|
||||
}
|
||||
|
||||
type QueryHandler<
|
||||
>QueryHandler : QueryHandler<TQuery, TOrderBy>
|
||||
|
||||
TQuery extends Query<TOrderBy>,
|
||||
TOrderBy extends string = NonNullable<TQuery["order"]>["orderBy"]
|
||||
> = {}
|
||||
|
||||
+17
@@ -1,6 +1,8 @@
|
||||
// @noEmit: true
|
||||
// @strict: true
|
||||
|
||||
// repro from #50539
|
||||
|
||||
interface StateSchema {
|
||||
states?: {
|
||||
[key: string]: StateSchema;
|
||||
@@ -14,3 +16,18 @@ declare class StateNode<TStateSchema extends StateSchema> {
|
||||
type StateNodesConfig<TStateSchema extends StateSchema> = {
|
||||
[K in keyof TStateSchema["states"]]: StateNode<NonNullable<TStateSchema["states"]>[K]>;
|
||||
};
|
||||
|
||||
// repro from #50539#issuecomment-1234067835
|
||||
|
||||
type Ordering<TOrderBy extends string> = {
|
||||
orderBy: TOrderBy
|
||||
}
|
||||
|
||||
type Query<TOrderBy extends string> = {
|
||||
order?: Ordering<TOrderBy>
|
||||
}
|
||||
|
||||
type QueryHandler<
|
||||
TQuery extends Query<TOrderBy>,
|
||||
TOrderBy extends string = NonNullable<TQuery["order"]>["orderBy"]
|
||||
> = {}
|
||||
Reference in New Issue
Block a user