forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mapped type support for array subtypes, like microsoft#26063
- Loading branch information
Showing
8 changed files
with
114 additions
and
32 deletions.
There are no files selected for viewing
This file contains 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
31 changes: 20 additions & 11 deletions
31
...rcularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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 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
31 changes: 20 additions & 11 deletions
31
tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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,60 @@ | ||
tests/cases/compiler/specedNoStackBlown.ts(7,50): error TS2315: Type 'SpecValue' is not generic. | ||
tests/cases/compiler/specedNoStackBlown.ts(7,84): error TS2315: Type 'SpecValue' is not generic. | ||
tests/cases/compiler/specedNoStackBlown.ts(22,29): error TS2315: Type 'SpecObject' is not generic. | ||
tests/cases/compiler/specedNoStackBlown.ts(25,13): error TS2456: Type alias 'SpecObject' circularly references itself. | ||
tests/cases/compiler/specedNoStackBlown.ts(25,81): error TS2315: Type 'SpecValue' is not generic. | ||
tests/cases/compiler/specedNoStackBlown.ts(27,13): error TS2456: Type alias 'SpecValue' circularly references itself. | ||
tests/cases/compiler/specedNoStackBlown.ts(30,78): error TS2315: Type 'SpecObject' is not generic. | ||
|
||
|
||
==== tests/cases/compiler/specedNoStackBlown.ts (7 errors) ==== | ||
// Type definitions for spected 0.7 | ||
// Project: https://github.com/25th-floor/spected | ||
// Definitions by: Benjamin Makus <https://github.com/benneq> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 2.8 | ||
|
||
declare function spected<ROOTINPUT, SPEC extends SpecValue<ROOTINPUT, ROOTINPUT> = SpecValue<ROOTINPUT, ROOTINPUT>>(spec: SPEC, input: ROOTINPUT): Result<ROOTINPUT, SPEC>; | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS2315: Type 'SpecValue' is not generic. | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS2315: Type 'SpecValue' is not generic. | ||
|
||
type Predicate<INPUT, ROOTINPUT> = (value: INPUT, inputs: ROOTINPUT) => boolean; | ||
|
||
type ErrorMsg<INPUT> = | ||
| (string | number | boolean | symbol | null | undefined | object) | ||
| ((value: INPUT, field: string) => any); | ||
|
||
export type Spec<INPUT, ROOTINPUT = any> = [Predicate<INPUT, ROOTINPUT>, ErrorMsg<INPUT>]; | ||
|
||
export type SpecArray<INPUT, ROOTINPUT = any> = Array<Spec<INPUT, ROOTINPUT>>; | ||
|
||
export type SpecFunction<INPUT, ROOTINPUT = any> = [INPUT] extends [ReadonlyArray<infer U>] | ||
? (value: INPUT) => ReadonlyArray<SpecArray<U, ROOTINPUT>> | ||
: [INPUT] extends [object] | ||
? (value: INPUT) => SpecObject<INPUT, ROOTINPUT> | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS2315: Type 'SpecObject' is not generic. | ||
: (value: INPUT) => SpecArray<INPUT, ROOTINPUT>; | ||
|
||
export type SpecObject<INPUT, ROOTINPUT = any> = Partial<{[key in keyof INPUT]: SpecValue<INPUT[key], ROOTINPUT>}>; | ||
~~~~~~~~~~ | ||
!!! error TS2456: Type alias 'SpecObject' circularly references itself. | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS2315: Type 'SpecValue' is not generic. | ||
|
||
export type SpecValue<INPUT, ROOTINPUT = any> = [INPUT] extends [ReadonlyArray<any>] | ||
~~~~~~~~~ | ||
!!! error TS2456: Type alias 'SpecValue' circularly references itself. | ||
? SpecArray<INPUT, ROOTINPUT> | SpecFunction<INPUT, ROOTINPUT> | ||
: [INPUT] extends [object] | ||
? SpecArray<INPUT, ROOTINPUT> | SpecFunction<INPUT, ROOTINPUT> | SpecObject<INPUT, ROOTINPUT> | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS2315: Type 'SpecObject' is not generic. | ||
: SpecArray<INPUT, ROOTINPUT> | SpecFunction<INPUT, ROOTINPUT>; | ||
|
||
export type Result<INPUT, SPEC> = {[key in keyof INPUT]: true | any[] | Result<INPUT[key], any>}; | ||
|
||
export default spected; | ||
|
This file contains 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