Commit graph

3219 commits

Author SHA1 Message Date
Daniel Rosenwasser a90389a22d
Switch deferredNodes from a Map to a Set. (#46751) 2021-11-23 17:46:33 -08:00
Andrew Casey 1ade73df2b
Stop calling our own @deprecrated APIs (#46831)
* Clean up createMap

* Delete dead createMapFromTemplate

* Clean up assertDefined

* Delete dead assertEachDefined

* Delete dead createUnderscoreEscapedMap

* Delete dead hasEntries

* Delete dead ReadonlyNodeSet, NodeSet, ReadonlyNodeMap, NodeMap

* Use updated SyntaxKind names

* Update API baselines
2021-11-18 10:37:55 -08:00
Kagami Sascha Rosylight ae582a22ee
Add target: "es2022" (#46291)
* Add `target: "es2022"`

* Add Object.hasOwn

* formatToParts is es2018

* ref update

* optional parameter

* Revert "optional parameter"

This reverts commit e67d6e5f60.

* undefined

* error cause

* Lint fix

Co-authored-by: Orta <git@orta.io>
2021-11-04 10:55:11 -07:00
Anders Hejlsberg 831b770b95
Control flow analysis for destructured discriminated unions (#46266)
* CFA for dependent variables destructured from discriminated union

* Accept new baselines

* Add tests

* Limit calls to isSymbolAssigned

* Fix wrong operator
2021-11-02 15:48:13 -07:00
Anders Hejlsberg 56f81075f9
Properly check whether union type contains only primitive types (#46645)
* Properly check whether union type contains only primitive types

* Add regression test

* Remove 'export' modifier from test
2021-11-02 12:46:26 -07:00
Gabriela Araujo Britto 9cdbb7248b
Improve errors on module: node12 and extensionless relative imports (#46486)
* add new error + suggestions

* push down assert defined

* remove comment

* fix esm module import detection, update baselines

* add and update new tests

* fix review comments

* remove renamed baseline references

* update node modules test baselines

* fix error message, add new tests

* update old tests with new error message
2021-10-29 10:25:03 -07:00
Gabriela Araujo Britto fd620c93f6
Add method signature completions (#46370)
* prototype creation for method override completion snippet

* WIP: start using codefix `addNewNodeForMemberSymbol` to create method decl node

* update type of addNewNodeForMemberSymbol

* add more tests and support more cases

* add more tests and fix some details

* wip: more fixes and tests

* expose check override modifier in checker

* fix test

* WIP: add snippet support

* WIP: snippet support on emitter, adding snippets in completions

* make add snippets work with overloads (not synced)

* fix snippet adding

* rebase

* WIP: try to add snippet escaping in emitter

* support escaping in snippets

* small fixes; fixed tests

* more tests and fixes

* fix new tests

* fix modifier inheritance for overloads

* merge conflict fixes; remove comments

* throw error if setOptions is called but not implemented

* fix newline handling

* fix weird stuff

* fix tests

* fix more tests

* Fix unbound host.getNewLine

* fix isParameterDeclaration changes

* rename diagnostic to status and remove snippets from public api

* rename emitter functions + fix indentation

* check completion kind before calling isclasslikemembercompletion

* fix missing type parameters

* Revert "fix missing type parameters"

This reverts commit 7bdeaa86da.

* add isAmbient flag to addNewNodeForMemberSymbol

* add test for abstract overloads

* refactor snippet escaping support

* add user preference flag for enabling class member snippets

* update API baseline

* update tabstop order

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
2021-10-28 16:05:36 -07:00
Wesley Wigham abfd537503
Support resolveJsonModule in new module modes (#46434)
* Support resolveJsonModule in new module modes

* Formatting feedback
2021-10-27 12:30:06 -07:00
Anders Hejlsberg 449aaa118f
Defer computation of isDistributionDependent to avoid circularities (#46474)
* Defer computation of isDistributionDependent to avoid circularities

* Accept new API baselines
2021-10-22 09:13:54 -07:00
Anders Hejlsberg f2f35ae78b
Simplify relationship check for conditional type on target side (#46429)
* Simplify relationship check for conditional type on target side

* Accept new baselines

* Better support for non-distribution-dependent types

* Accept new API baselines

* Accept new baselines
2021-10-21 17:35:23 -07:00
Jack Bates 248d478956
Remove defaultValueDescription: "n/a" from options (#46280)
* Remove defaultValueDescription: "n/a" from options

* CommandLineOption type <-> defaultValueDescription

* Require defaultValueDescription of number/boolean options
2021-10-19 15:19:19 -07:00
Nathan Shively-Sanders 8d715ff53e
Error on mapped type w/properties (#46346)
* Error on mapped types with properties

1. Error on properties of type literals with computed properties whose name is a
binary expression with `in`, because that's a good sign of a mapped
type.
2. Parse following properties on mapped types, and error on them.
3. Stop checking computed property names in (1) to avoid producing
errors based on misinterpreting mapped type syntax as an expression.

* add comment in types.ts

* Update API again

* Check interfaces and classes too

* Add missed check in updateMappedTypeNode
2021-10-18 09:00:00 -07:00
Kagami Sascha Rosylight 2161e1852f
Add module: es2022 (#44656)
Closes #44653
2021-09-29 17:44:57 -07:00
Andrew Branch e160bc8c0d
Type-only import specifiers (#45998)
* Parse type-only import specifiers

* Add type-only export specifiers

* Update transform and emit

* Update checking

* Fix elision when combined with importsNotUsedAsValues=preserve

* Accept baselines

* Add test

* WIP auto imports updates

* First auto-imports test working

* More auto-import tests

* Fix auto imports of type-only exports

* Add test for promoting type-only import

* Sort import/export specifiers by type-onlyness

* Update completions for `import { type |`

* Update other completions tests

* Respect organize imports sorting when promoting type-only to regular while adding a specifier

* Fix comment mistakes

* Update src/services/codefixes/importFixes.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* Rearrange some order of assignments in parser

* Split huge if statement

* Remove redundant check

* Update new transformer

* Fix import statement completions

* Fix type keyword completions good grief

* Fix last tests

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-09-27 12:38:30 -07:00
Anders Hejlsberg 2f0c6070cb
Properly handle missingType in intersections (#46052)
* Properly handle missingType in intersections

* Add regression tests

* Accept new baselines

* Fix tests
2021-09-26 14:13:42 -07:00
Wesley Wigham 586b0d5011
moduleResolution: node12 support (#45884)
* Initial support for module: node12

* Add allowJs and declaration emit enabled tests

* Fix typos

* cts, mts, cjs, mjs, etc extension support

* Fix watch of files whose intepretation changes due to a package.json update

* Minor PR feedback

* Adjust error message

* Initial import/export/self-name support

* Accept new error codes

* TypesVersions support in export/import map conditions

* Fix import suggestion and autoimport default extensions under new resolution modes

* Add tests for import maps non-relative name lookup feature

* Fix isDeclarationFileName for .d.mts and .d.cts

* Preserve new extensions when generating module specifiers

* Fix spurious implict any suggestion caused by file ordering bug and optimize import name format detection by relying on parents being set

* Fix a bunch of incremental bugs that dont repro under fourslash for some reason

* Accept updated baseline

* Always include extensions on completions for cjs/mjs style imports

* String completion relative import suggestions respect the mode of the import when choosing if they provide extensions

* Style feedback

* Change diagnostic case
2021-09-24 14:25:59 -07:00
Ashley Claymore af689cc5d5
ES private field check (#44648)
* es private fields in in (#52)

add support for the 'private-fields-in-in' TC39 proposal

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [fixup] include inToken when walking forEachChild(node, cb)

* [squash] re-accept lib definition baseline changes

* [squash] reduce if/else to ternary

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] drop 'originalName' and rename parameter instead

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] extend spelling suggestion to all privateIdentifiers

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] revert the added lexical spelling suggestions logic

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] update baseline

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] inline variable as per PR suggestion

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] test targets both esnext and es2020 as per PR comment

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* switch to using a binary expression

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] PrivateIdentifier now extends PrimaryExpression

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] accept public api baseline changes

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] classPrivateFieldInHelper now has documentation

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] type-check now follows existing in-expression path

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] parser now follows existing binaryExpression path

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] correct typo in comment

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] no longer use esNext flag

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] swap 'reciever, state' helper params

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] remove change to parenthesizerRules

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] apply suggested changes to checker

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] remove need for assertion in fixSpelling

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] improve comment hint in test

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] fix comment typos

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] add flow-test for Foo | FooSub | Bar

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] add checkExternalEmitHelpers call and new test case

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] simplify and correct parser

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] move most of the added checker logic to expression level

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] always error when privateId could not be resolved

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] reword comment

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] fix codeFixSpelling test

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] do less work

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* store symbol by priateId not binaryExpression

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* moved parsePrivateIdentifier into parsePrimaryExpression

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] checkInExpressionn bails out early on silentNeverType

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] more detailed error messages

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] resolves conflict in diagnosticMessages.json

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] update baseline for importHelpersES6

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] remove redundent if and comment from parser

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] split up grammar/check/symbolLookup

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>

* [squash] reword message for existing left side of in-expression error

Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>
2021-09-24 09:05:27 -07:00
Anders Hejlsberg a4f9bf0fce
Create type aliases for unresolved type symbols (#45976)
* Create type aliases for unresolved type symbols

* Accept new baselines

* Update fourslash tests

* Unresolved import aliases create tagged unresolved symbols

* Add comments

* Accept new baselines

* Add fourslash tests
2021-09-23 13:21:27 -07:00
Armando Aguirre 24e3b6bf59
Added Jsx Snippet Completion feature (#45903)
* Added Jsx completion feature and tests

* Renamed jsxSnippetCompletion to jsxAttributeCompletionStyle

* Renamed tests files

* Changed boolean filter

* Escaped snippet
2021-09-22 16:09:00 -07:00
Wenlu Wang ec114b8931
Import assertion (#40698)
* Add parsing

* fix all api

* check gramma of import call

* Add more part of assertion

* Add some case

* Add baseline

* use module insted of target

* strip assertion in d.ts

* Update new baseline

* accept baseline

* Revert error number changes

* Update diagnostic message

* Accept baseline

* rename path

* Fix cr issues

* Accept baseline

* Accept baseline

* Error if assertion and typeonly import

* Accept baseline

* Make lint happy

* Add some comment

* Fix cr issues

* Fix more issue

* Incorporate PR feedback, fix module resolution for import()

* Add contextual type and completions for ImportCall options argument

Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
2021-09-20 14:15:22 -07:00
Justin Brown f7a80029a3
Fix for resolvedTrueType and resolvedFalseType of conditionType not resolved (#45838)
* Fix for Issue #45537

* tests/baselines/reference/* files updated
2021-09-16 09:26:43 -07:00
Andrew Branch 8610ff5ebe
Add --preserveValueImports (#44619)
* Add compiler option

* Require es2015+

* Do not elide any imports or exports in preserve-exact

* Add errors for writing imports/exports that reference elided names

* Improve diagnostics wording

* Update API baselines

* Redo as noEraslingImportedNames

* Update option category

* Update baselines

* Lint

* Fix up transformer comments

* Fix errors from merge

* Update other error code baseline

* Rename to "preserveValueImports"

* Clean up, reword diagnostics

* Update API baselines

* Update other baseline affected by error message reword

* Update tsconfig baselines

* Add debug assertion instead of !
2021-09-08 16:30:22 -07:00
Hiroshi Ogawa 617251f2e0
feat(45010): handle unclosed fragment in getJsxClosingTagAtPosition (#45532)
* feat(45010): handle unclosed fragment in `getJsxClosingTagAtPosition`

* Update tests

* Fix types of `JsxText.parent` and `JsxExpression.parent`
2021-09-08 09:22:38 -07:00
Ron Buckton 6f7f3b1775
Minor fixes to "Convert To Async" refactor (#45536)
* Minor fixes to convertToAsync

* Back out on nested return in inner continuation

* Baseline update

* Verify type argument for call can be used, add a few more early exit shortcuts
2021-09-01 13:13:12 -07:00
Ron Buckton 107c556fe4
Fix 'as const'-like behavior in JSDoc type cast (#45464) 2021-08-27 18:22:02 -07:00
Andrew Casey 7fc1cb4b36
Use realpathSync.native on case-insensitive file systems (#44966)
* Make getSourceOfProjectReferenceRedirect take a Path

* Add useCaseSensitiveFileNames to ModuleResolutionHost

...so that path comparisons can use it during module resolution.

* Re-enable realpathSync.native for case-insensitive file systems
2021-08-26 15:35:04 -07:00
David Rogers d18e82b380
fix for 45006 (#45020)
* fix for 45006

* treat setters like getters in preceding commit; move test accordingly

* fix test baselines

* changes per code review

in `getContainerFlags`, move cases for get/set accessors
to fallthrough into the block that currently handles MethodDeclaration;
so get/set accessors and method declarations all get the same container flags,
such that during `bindContainer`, `startFlow.node` is assigned to
getters/accessors
(this changes a public api in tsserverlibrary.d.ts and typescript.d.ts
by adding `GetAccessorDeclaration` and `SetAccessorDeclaration` to the type
of `FlowStart.node`)

consolidate predicates checking whether a node is either a get or set
accessor, into `isObjectLiteralOrClassExpressionMethodOrAccessor`
(formerly `isObjectLiteralOrClassExpressionMethod`)

annotate updated test with `@target: es2020`

* fix `isObjectLiteralOrClassExpressionMethodOrAccessor`

require that Getter/Setters are parented by an ObjectLiteralExpression or ClassExpression
2021-08-20 17:05:19 -07:00
Gabriela Araujo Britto 945179fb64
Reuse checker's property accessibility check for completions (#45388)
* add test for completions crash

* WIP: experiment

* remove comments

* add call to getParseTreeNode

* Revert "add call to getParseTreeNode"

This reverts commit 8dd1cf67cf.

* Fix comments

* minor fixes

* fix formatting

* rename type to containingType
2021-08-19 13:02:20 -07:00
Gerrit Birkeland e263fcebf8
Expose getTypePredicateOfSignature (#44863) 2021-08-16 17:17:42 -07:00
Nathan Shively-Sanders 8d4fe5a0fb
Fix unassignable properties by adding undefined with exactOptionalPropertyTypes (#45032)
* Simple first version

Doesn't cover or test any complicated variations.

* Lots of cases work

Destructuring does not. But

- skipping node_modules and lib.* does.
- call expressions does
- property access, including with private identifiers, does

* Support variable declarations, property assignments, destructuring

As long as it's not nested

* More cleanup

* skip all d.ts, not just node_modules/lib

* Offer a codefix for a lot more cases

* remove incorrect tuple check

* Use getSymbolId instead of converting to string

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>

* add test + switch to tracking number symbol ids

* Address PR comments

* Exclude tuples from suggestion

* Better way to get error node

Plus add a check that errorNode is an argument to the call, not the
call's expression.

* fix semicolon lint

* fix another crash

* Simplify: add undefined to all optional propertie

whether or not somebody tried to assign undefined to them in the
erroneous assignment

* remove fix-all

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
2021-08-10 16:57:38 -07:00
Anders Hejlsberg 3bd5079f1c
Fix check for generic types in control flow analysis (#45148)
* Fix check in hasNonBindingPatternContextualTypeWithNoGenericTypes

* Add regression tests

* Accept new baselines

* Compute both ObjectFlags.IsGenericXXXType flags in one go
2021-08-06 08:53:30 +02:00
Andrew Branch f80bc3f5f0
Store symbol table map key in CachedSymbolExportInfo (#45289)
* Store symbol table map key in CachedSymbolExportInfo

* Remove debug assertion

* Filter out known symbols (again) and private identifiers
2021-08-04 16:31:47 -07:00
Oleksandr T c4080437b2
fix(45102): do not suggest refactoring for functions contains arguments reference (#45116) 2021-08-03 11:31:56 -07:00
Kubilay Kahveci 9cc3070938
expose getImmediateAliasedSymbol() publicly (#44644)
Signed-off-by: Kubilay Kahveci <kahvecikubilay@gmail.com>
2021-08-02 15:57:54 -07:00
Gabriela Araujo Britto 366e9de264
Fix compiler crash on property symbols without declarations (#45190)
* don't track computed name if symbol has no declaration

* add compiler test

* add non serializable property declaration emit error

* don't track computed name if symbol has no declaration

* fix small stuff

* rebase: add non serializable property declaration emit error

* use symbolToString instead of symbolName
2021-07-29 12:42:54 -07:00
Ron Buckton 365b25693c
Fix and validate post-increment/decrement in module emit (#44968) 2021-07-19 13:34:42 -07:00
Andrew Branch 36225c3260
Detect preference for Unode:-prefixed node core modules (#45080) 2021-07-19 09:56:24 -07:00
Wesley Wigham 8e855d140b
Watch mode watches for changes in package.json files used in resolution (#44935)
* watch mode watches for changes in package.json files used in resolution

* Pathify result of realpath

* Actually accept pathified baselines
2021-07-12 17:23:08 -07:00
Ron Buckton 66c3063b06
Add collision check for 'Reflect' when using super in static initializers (#44876)
* Add collision check for 'Reflect' when using super in static initializers

* PR feedback

* Accept baseline for new failing test
2021-07-10 12:48:54 -07:00
Wenlu Wang dc237b317e
Change static fields emits (#43114)
* use emit into iife

* Update emit

* Revert un-related changes

* Allow super in static context

* Allow this and super in static property declaration

* Add more tests

* Avoid errors

* Accept baseline

* Accept baseline

* Add decorated classes test

* Add errors

* Avoid this in emitter

* make lint happy

* Add class expression tests

* Add computed name test

* Avoid super if target below es6

* Adjust function boundary

* Add internal

* Fix minor CR issues

* accept baseline

* Update behavior

* Avoid spaces

* Make lint happy

* Avoid function boundary utils

* Update baseline

* Avoid errors

* Accept baseline

* Accept baseline

* Accept baseline

* Accept baseline

* Use substitutions

* Full coverage for super, this, merge static and private context

* Fix use-before-def in static fields

Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
2021-06-25 15:49:27 -07:00
Andrew Branch 328e888a9d
Resolve module specifiers for auto imports in completion list (in incomplete chunks) (#44713)
* Enable module specifiers for all auto imports

* Use isIncomplete

* isIncomplete continuation

* Lots of fixes

* Merged/transient symbol fixes, resolve all ambient module specifiers up front, pull as many as we want from cache

* Fix existing tests

* Start testing

* Add more tests

* Set cache attempt limit, update API baseline

* Fix a few tests

* Fix contextToken

* Split getModuleSpecifiers

* Unexport function

* Clean up importFixes

* Clean up completions

* Delete transient symbol assertion - fixing later
2021-06-25 17:26:53 -05:00
Wenlu Wang 906cbd2715
Proposal class static block support (#43370)
* Class static block (#9)

* Add types factory and parser

* Add some case

* Make class static block as a container

* Update cases

* Add visitor

* Add emitter and more compile target

* Check boundary of break and continue

* Add basic transformer

* Fix emit behavior

* Add more tests

* Add friend tests

* Update baseline

* Fix cr issues

* Accept baseline

* Add decorator and modifier check

* Add functional boundary check

* Fix conflict

* Fix computed prop name within context

* Add more tests

* Update baseline

* Avoid invalid test baseline

* Support use before initialize check

* wip

* Fix class static block context

* Fix checks

* Fix missing case

* Improve assert message

* Accept baseline

* Avoid new context

* Update diagnostic message

* Fix name collision

* Fix targets

* Avoid unnecessary files

* Add more case

* Add more test cases

* Fix strict mode function declaration

* Avoid private fields initializer if no private identifier references

* Avoid private fields and add more test case

* Add more case

* Add tests and support for related services functionality

* Fix this reference in static block

* Split parser diagnostic and binder diagnostic

Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
2021-06-25 09:24:05 -07:00
Wenlu Wang 66b4ba4b35
Add inlay hints support (#42089)
* Add signature arguments label support

* Support rest parameters and destruction

* make lint

* Fix tuple rest parameters

* Adjust name styles

* Rename to inline hints

* Partition inline hints

* Adjust range pred

* Add function expression like hints

* Support configure inline hints

* Display hints in single line

* Add test suits and tests

* Add range tests

* Support more hints

* Add more options

* Fix logical

* Add more cases

* Support call chains

* Rename options

* Match lastest protocol

* Update protocol changes

* Support context value and hover message

* Revert "Support context value and hover message"

This reverts commit 37a7089633.

* Revert "Update protocol changes"

This reverts commit e5ca31bc30.

* Add hover message

* Accept baseline

* Update src/services/inlineHints.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* Update src/services/inlineHints.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* Cache across the program

* Fix possible undefined

* Update protocol changes

* Fix missing property

* Make lint happy

* Avoid call chain hints

* I'm bad

* Add whitespace before type

* Add more tests

* Should care about jsdoc

* Support complex rest parameter

* Avoid module symbol  hints

* Care about leading comments

* Fix CR issues

* Avoid changes

* Simplify comments contains

* Fix CR issues

* Accept baseline

* Check parameter name before create regex

* Rename option

* Avoid makers

* Skip parens for argument

* Fix CR issues

* Fix enums

* Accept baseline

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-06-24 23:06:34 -07:00
Ron Buckton 711b4e778b
Indirect calls for imported functions (#44624)
* Indirect calls for imported functions

* Fix unit tests
2021-06-21 19:51:13 -07:00
Anders Hejlsberg 0e905be42b
Index signatures for symbols and template literal strings (#44512)
* Switch index signature storage to 'indexInfos: IndexInfo[]' property

* Accept new baselines

* Remove another usage of IndexKind enum

* Update getIndexedAccessType and resolveMappedTypeMembers

* Accept new baselines

* Update grammar checking for index signatures

* Accept new baselines

* Consider all index signatures in mapped types and union types

* Accept new baselines

* Update getIndexType

* Accept new baselines

* Intersect multiple applicable index signatures

* Use getApplicableIndexInfo instead of hardwired string/number handling

* Update index signature relationship checking

* Report type for which index signature is missing

* Report type for which index signature is missing

* Accept new baselines

* Make 'number' index signatures consistently apply to numeric strings

* Accept new baselines

* Update fourslash test

* Revise index constraint checking

* Accept new baselines

* Update error messages

* Accept new baselines

* Update type inference from index signatures

* Update isKnownProperty

* Update contextual typing based on index signatures

* Accept new baselines

* Support union types in index signature declarations

* Accept new baselines

* Check duplicate index signatures / remove redundant template literals from unions with string

* Accept new baselines

* Include key type in diagnostic / check symbol-named properties

* Accept new baselines

* Minor fix

* Add tests

* Accept new baselines

* Add optimized findApplicableIndexInfoForName

* Accept new baselines

* Another place we don't need to obtain literal type for property name

* Accept new baselines

* Don't create literal types that are going to be discarded

* Individual maps for string, number, bigint, and enum literal types

* Remove ineffective optimizations

* Accept new baselines

* Permit intersections as key types in index signatures

* Index expression in element access is template literal context

* Add tests

* Accept new baselines

* Symbol index signatures from object literals with computed symbol properties

* Accept new baselines

* Add more tests

* Accept new baselines

* Implement Go To Definition for all applicable index signatures

* Add fourslash test

* Accept new API baselines
2021-06-21 11:25:42 -07:00
Ryan Cavanaugh 5afe42e14e
Rename strictOptionalProperties -> exactOptionalPropertyTypes and remove from strict family (#44626) 2021-06-17 15:12:19 -07:00
Oleksandr T eee34d539c
feat(28491): add QF to declare missing properties (#44576) 2021-06-17 11:12:29 -07:00
Song Gao 971133d5d0
New command line help developer experience. (#44157)
* refactor help CLI output.

* fix typo and omit false condition boolean output.

* fix typo

* add line break

* add --plugins option to basic option category.

* add ts icon and remove old print help function.

* better command description for --jsx.

* Fix test

* fix lint

* Improvements to the UX

* Fix tests

* fix test.

* add missing help out.

* use environemnt variable to control test case.

* fix merge issues.

* No `No Category`

* make getWidthOfTerminal optional.

* fix test

* fix review.

* fix review.

* Update baselines

Co-authored-by: Orta <git@orta.io>
2021-06-16 14:18:00 +01:00
Anders Hejlsberg 6a1623d413
Ensure singleton types always compare identical (#44565)
* Singleton types should compare identical + fix boolean types

* Add tests

* Accept new baselines
2021-06-13 12:51:36 -07:00
Ron Buckton a0c44b26b7
Improve __spreadArray perf, and other fixes related to SpreadElement (#44527)
* Improve __spreadArray perf, fix array packing and trailing omitted expressions

* Ensure __spreadArray is backwards-compatible

* Add signature restriction for __spreadArray

* Added reusable true/false literals
2021-06-11 16:21:55 -07:00