* Add declaration emit error and checking for circularly referential unions produced by recursive conditionals
* Allow indexed accesses to produce alias symbols on types
* Add test that still triggers the declaration emit error
* Fix spelling
* fix: range of ts2657 (jsx expr must have parent) and remove 2695 (LHS expr of comma has no side effects)
* feat: add code fix for 2657
* fix: resolve review
* chore: hoist a var
* chore: add test for skipTrivia
* fix: rebase error
* Update src/compiler/diagnosticMessages.json
Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
* Update src/services/codefixes/wrapJsxInFragment.ts
Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
Co-authored-by: Andrew Branch <andrew@wheream.io>
Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
* 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
* feat(37782): add quick-fix action to declare a private method for names that start from underscore
* better merge order in messages json
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* Elaborate on reasons for 'never' intersections
* Accept new API baselines
* Accept new baselines
* Add tests
* Accept new baselines
* Address CR feedback
* stash
* add surmise for return type
* add support for more case
* add more test case
* add more testcase and fix all test
* fix changed diagnosis
* fix broken test case
* add more case
* rename quickfix
* fix conflict
* fix fix desc
* fix semi
* Avoid replace brace with paren
* Split fix all action
* Add return work in same line
* fix test cases
* rename baseline
* refactor and handle comment
* Support semi
* make helper internal
* Add Advanced Compile Options to --init command
* removed advanced options and descriptioncolumn
* tests: fix tsconfig.json baselines
* tests: fix failing tests
* feat: adjusted link to specification
* fix: removed duplicate increment flag
* chore: moved position back
* return of the comments
* fix for missalignment
* return of the comment
* New diagnostic message for wrong JSX function component
* Component and Mixed type
* fix existing tests
* add new test for JSX component return type error
* fix tslint error
* update diagnostic message to include component name
* accept baseline
* update tests
* missing semicolon
* accept baseline
Co-authored-by: Wesley Wigham <wwigham@gmail.com>
* Enhancement new expression with type arguments without parenthesized argument list error message
Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
* add baselines
Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
* use parseErrorAt
Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
* refine code
Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
* Space before paren
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
* Add codefix for --noImplicitThis
* Code review
* Back to building post-merge
* Remove redundant functions + update tests
Infer-from-usage also inserts `this: any` parameters when needed, so I
removed that from fixImplicitThis.
Otherwise, fixImplicitThis has better suggestions than inferFromUsage,
so I moved inferFromUsage later in the suggestion order.
* More redundancy removal
Don't need to add `@this` anymore either since inferFromUsage will do
that.
* More baseline updates
From moving inferFromUsage down in priority I think?
* remove now-redundant ad-hoc jsdoc emit
* fix more bad merge
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
This addresses issue #28975
(https://github.com/microsoft/TypeScript/issues/28975).
When providing a value as a type argument, we can suggest a more specific
error message: "Did you mean to use typeof T?"
adds error message
WIP: Detect error
WIP: progress
updated tests
janky implementation
adds test coverage around literal types being unaffected
refactor out isIdentifierATypeArgument function
adds test case for type alias
adds test case for nested type arguments
fixes linting errors
merge master into branch to overwrite changes
changes value as type error message
This suggests 'typeof T' as a potential alternative when we give an error
about using value T as a type.
remove stale tests from old change
Co-authored-by: John Patterson <john@johnppatterson.com>
* Added @ts-expect-error to @ts-ignore directives
Similar to `// @ts-ignore`, but will itself cause a new error diagnostic if it does not cause an existing diagnostic to be ignored.
Technical summary:
1. The scanner will now keep track of `CommentDirective`s it comes across: both `@ts-expect-error` and `@ts-ignore`
2. During type checking, the program will turn those directives into a map keying them by line number
3. For each diagnostic, if it's preceded by a directive, that directive is marked as "used"
4. All `@ts-expect-error` directives not marked as used generate a new diagnostic error
* Renamed to getDiagnosticsWithPrecedingDirectives per suggestion
* Added JSDoc comment I thought I did already
Co-authored-by: Orta <orta.therox+github@gmail.com>
* Treat never-like intersections as never
* Accept new baselines
* Fix compiler issues revealed by increased intersection correctness
* Delete fourslash tests that are no longer applicable
* Include isNeverLikeIntersection check in getNormalizedType
* Erase never-like types in several more places
* Check that base types are not never-like
* Add comments
* Revert isNeverLikeType check in getIndexType (keyof shouldn't resolve member types)
* Introduce getReducedType for union and intersection types
* Don't reduce in getApparentType
* Avoid relationship check in resolveMappedTypeMembers
* Accept new baselines
* Don't call getReducedType in getIndexType
* Ensure reduced and unreduced forms of a type can compare identical
* Reduce types before converting them to string representation
* Accept new baselines
* Reduce intersections before obtaining keyof X
* Add tests
* Accept new baselines
* Fix comment in tests
* Don't infer from empty intersection types
* Add tests
* Accept new baselines
* Defer instantiation of mapped type property types
* Accept new baselines
* Include more precise type in diagnostic
* Accept new baselines
* Minor optimization
* Improve error message
* Optional properties in intersections are never discriminants
* Add tests for specifying composite as command line option
* Allow passing --composite false on commandline
* Add test to verify tsc --composite false from command line
* Handle "undefined" as option value to be set to undefined for that option
* Support "null" as option to be converted to undefined which is normally end result from our config file as well
* Support null as option for any tsconfig only option as well, and dont support undefined
* Fix public api test case
* Validates objects instead of stringify result
* Add composite true to base source