TypeScript/tests/cases/conformance/types/tuple/named/namedTupleMembersErrors.ts
Wesley Wigham 5f597e69b2
Support naming tuple members (#38234)
* Initial draft of named tuple members

* Show tuple labels and documentation in completions

* Swap allowed syntax to parameter-like

* Add quickfix for labeled tuple syntax mistakes

* Add refactoring to convert list of signatures to single overload

* Fix small bug in visitor verification

* Signature help for rest parameters which are unions of tuples are displayed as seperate entries now

* Expand sanity check test cases in conformance suite

* Add tests and code for preserving tuple names through spreads where possible

* More refactoring tests, some comment preservation and some fixed formatting of multiline tuples

* Handle missing parameter named in isValidDeclarationForTupleLabel

* Minor text fixes
2020-05-19 15:54:02 -07:00

20 lines
900 B
TypeScript

// @declaration: true
export type Segment1 = [length: number, number]; // partially named, disallowed
export type List = [item: any, ...any]; // partially named, disallowed
export type Pair = [item: any, any?]; // partially named, disallowed
export type Opt = [element: string?]; // question mark on element disallowed
export type Trailing = [first: string, rest: ...string[]]; // dots on element disallowed
export type OptTrailing = [first: string, rest: ...string[]?]; // dots+question on element disallowed
export type OptRest = [first: string, ...rest?: string[]]; // rest+optional disallowed
export type NonArrayRest = [first: string, ...rest: number]; // non-arraylike rest, disallowed
export type RecusiveRestUnlabeled = [string, ...RecusiveRestUnlabeled];
export type RecusiveRest = [first: string, ...rest: RecusiveRest]; // marked as incorrect, same as above