Commit Graph
514 Commits
Author SHA1 Message Date
Nathan Shively-SandersandGitHub 6bd1da20c9 Rename JS-specific concepts (#26795)
* Rename JS concepts

1. Assignment declaration -- an assignment that is treated like a
declaration. Previously called [JS] special (assignment|declaration),
among other things.
2. Expando -- a value that can be used as a target in assignment
declarations. Currently, a class, function or empty object literal.
Functions are allowed in Typescript, too. Previously called a JS
container, JS initializer or expando object.
3. JavaScript -> Javascript. This is annoying to type, and looks like
'Java Script' in a camelCase world.

Everything is a pure rename as far as I know. The only test change is
the API baselines, which reflect the rename from SymbolFlags.JSContainer
to SymbolFlags.Assignment.

* Remove TODO

* Rename Javascript->JS

Note that this introduces a variable name collision in a couple of
places, which I resolved like this:

```ts
const isInJavascript = isInJSFile(node);
```
2018-09-12 10:44:46 -07:00
Ron Buckton a255d9a163 Merge branch 'master' into typesVersions 2018-09-07 13:52:12 -07:00
AndyandGitHub bcb815b3ac Remove duplicate function createTextRange (#23346)
* Remove duplicate function createTextRange

* Always allow end=-1

* Put noAssert back, pending #23370

* Use getRangeUnion helper

* Update API (#24966)
2018-09-05 11:19:56 -07:00
Benjamin LichtmanandGitHub 6ddf75209a Merge pull request #26749 from uniqueiniquity/getWholeType
Use correct type for async refactoring diagnostics
2018-08-31 09:09:25 -07:00
Benjamin Lichtman 64bbf8925c Allow for undefined in type 2018-08-30 16:53:46 -07:00
AndyandGitHub f78dc2ad11 importFixes: Only provide a fix using the best module specifier for a given module (#26738) 2018-08-29 16:18:56 -07:00
Benjamin Lichtman 97e539339d Add comment explaining special casing 2018-08-29 15:53:34 -07:00
Benjamin Lichtman 158f0b0c0b Allow codefix to apply to function expression in variable declaration 2018-08-29 15:52:35 -07:00
Ron Buckton 210de32933 Merge branch 'master' into typesVersions 2018-08-29 13:26:13 -07:00
AndyandGitHub 02630273a2 codeFixInferFromUsage: Assume that using x[0] means that x is an array (#26739)
* codeFixInferFromUsage: Assume that using `x[0]` means that `x` is an array

* Remove unnecessary '||' with non-falsy LHS

If only there were some kind of type-checker for JavaScript that could detect this sort of thing
2018-08-29 11:37:31 -07:00
Ron Buckton 5f6a2cbf69 Merge branch 'master' into typesVersions 2018-08-28 17:37:23 -07:00
AndyandGitHub 552bd1c8a2 Support import fix/completions for export = (#25708) 2018-08-28 13:04:11 -07:00
AndyandGitHub 4cf5774c5e Add tsserver test for completions and avoid excess properties (#25622) 2018-08-27 16:04:02 -07:00
Wenlu WangandAndy 8ba501926a try get add missing member return type from context (#26250)
* try get add missing member return type from context

* support contextual type
2018-08-23 21:31:53 -07:00
Ron Buckton 015babb6f7 Initial support for 'typesVersions' 2018-08-20 16:57:18 -07:00
Elizabeth DinellaandGitHub 421730a68d Refactoring promises returning functions to use async and await (#26373) 2018-08-10 16:11:45 -07:00
AndyandGitHub 4bb740218d getDefaultExportInfo: Use getImmediateAliasedSymbol instead of getAliasedSymbol (#26364) 2018-08-10 14:35:18 -07:00
AndyandGitHub 5efd1cb4a7 fixAddMissingMember: Support interface and don't crash on type parameter (#25995)
* fixAddMissingMember: Support interface and don't crash on type parameter

* Remove InfoBase
2018-08-09 17:32:28 -07:00
AndyandGitHub 9c9f3e3cf9 importFixes: When one file redirects to another, consider both for global import specifiers (#25834)
* importFixes: When one file redirects to another, consider both for global import specifiers

* Add test for #26044

* Avoid a symlinked package globally importing itself (fixes another case of #26044)

* Compare to node_modules with getCanonicalFileName
2018-07-31 17:28:56 -07:00
AndyandGitHub f326b4b7cb Make import fix for default import mention that it's a default import (#26105) 2018-07-31 17:28:35 -07:00
AndyandGitHub d40d54984e Support deleting all unused type parameters in a list, and deleting @template tag (#25748)
* Support deleting all unused type parameters in a list, and deleting @template tag

* Support type parameter in 'infer'
2018-07-27 11:55:31 -07:00
AndyandGitHub 0227997fa5 Use import().T for import completions/fixes of pure types in JS files (#25852)
* Use `import().T` for import completions/fixes of pure types in JS files

* Don't call tryUseExistingNamespaceImport if position undefined
2018-07-26 16:16:57 -07:00
Nathan Shively-SandersandGitHub 9658b476c2 Fix inferFromUsage on index signatures (#25934)
* Fix inferFromUsage on index signatures

1. Check the argumentExpression to determine the index signature type.
Previously, the code mistakenly checked the type of the element access
itself, which never returned a good type.
2. If inference for the index signature type fails, substitute anyType.
Previously, the code would create a bad index signature with an
undefined type.
3. Add tests. Previously, there were no tests.

* Fixing (1) means that number index signatures are now created.
Previously, only string index signatures would be created.
* Fixing (2) means that index signatures will be inferred from single
usage like `return a[0]`. Previously, the refactoring would fail,
perhaps because of a check when stringifying the index signature (I
haven't tracked down why.)

* Update fourslash test with improved inference
2018-07-25 10:51:11 -07:00
AndyandGitHub 3d672d9550 Ensure fixSpelling and importFixes still trigger on "Did you mean the instance/static member ..." (#25847) 2018-07-20 16:51:35 -07:00
AndyandGitHub 89f2af17f0 Avoid using old node in import fix to use namespace import (#25729) 2018-07-17 13:34:56 -07:00
AndyandGitHub 27da9eab8d fixUnreachableCode: Don't delete whole block when non-first line is unreachable (#25625) 2018-07-13 09:57:04 -07:00
AndyandGitHub 5f4a03c408 Ensure TypeChecker#getTypeAtLocation returns a defined result (#25583)
* Ensure TypeChecker#getTypeAtLocation returns a defined result

* Update additional baseline
2018-07-11 16:33:56 -07:00
AndyandGitHub 1fc1495863 Increase span of unreachable code error (#25388)
* Increase span of unreachable code error

* Add a new diagnostic for each range of unreachable statements

* Update baselines
2018-07-10 11:45:16 -07:00
Daniel Rosenwasser 32bb63cbcf getSuggestionForNonexistentModule -> getSuggestionForNonexistentExport 2018-07-05 20:45:00 -07:00
Mohamed HegazyandGitHub 383319ded6 Merge pull request #25423 from Microsoft/defaultExportName
Handle getting name of default export that's an alias
2018-07-05 12:21:53 -07:00
Andy Hanson b1e916cae6 Handle getting name of default export that's an alias 2018-07-05 09:03:22 -07:00
Alexander T f851ab8f3e Add a suggestion - Did you mean 'typeof import()?. Add tests to handle undated error message 2018-07-04 16:04:29 +03:00
AndyandGitHub 064ecd449e Support code-fix-all for importFixes (#25137)
* Support code-fix-all for importFixes

* Change description

* Update API (#25283)
2018-07-03 15:19:15 -07:00
Andy Hanson 271bbb027c Merge branch 'master' into fixAddMissingMember_all_dedup 2018-07-02 16:06:57 -07:00
Mohamed HegazyandGitHub 956f9d0be2 Merge pull request #25335 from Microsoft/codeFixAddMissingEnumMember_all
Combine code-fix-all for missing class member and missing enum member
2018-07-02 15:14:19 -07:00
Andy Hanson e0109ea93e Remove shadowed variable 2018-07-02 13:26:31 -07:00
Andy Hanson f3bc891ae9 fixAddMissingMember: Improve deduplication in code-fix-all 2018-07-02 11:26:50 -07:00
AndyandGitHub ded446573a ChangeTracker: Combine deleteDeclaration, deleteNode, and deleteNodeInList (#25276)
* ChangeTracker: Combine deleteDeclaration, deleteNode, and deleteNodeInList

* Change name

* Update API (#24966)
2018-06-29 19:53:32 -07:00
Andy Hanson 2fa27ffdf7 Combine code-fix-all for missing class member and missing enum member 2018-06-29 19:39:19 -07:00
Mohamed HegazyandGitHub c27dace3df Merge pull request #25182 from Kingwl/fix-missing-enum-member
add quick fix for add missing enum member
2018-06-29 10:19:23 -07:00
王文璐 d8cdd7552e do not handle enum type member 2018-06-28 09:36:26 +08:00
AndyandGitHub fd8b7f3da5 Remove redundant checks in getNameOfDeclaration (#25244) 2018-06-27 13:56:31 -07:00
AndyandGitHub d957b1c8c2 fixUnusedIdentifier: Remove arguments corresponding to unused parameters (#25011)
* fixUnusedIdentifier: Remove arguments corresponding to unused parameters

* Update API (#24966)

* Fix handling of deletions: Make a list of things to delete and don't delete until the end

* Remove dummy test

* Bug fixes

* Update API (#24966)

* Move code to textChanges
2018-06-27 09:26:47 -07:00
王文璐 d6f5fc6518 add Initializer if enum value is another enum 2018-06-27 21:03:50 +08:00
AndyandGitHub 13bc46d970 getTokenAtPosition: default includeJsDocComment to true (#25015)
* getTokenAtPosition: default includeJsDocComment to true

* Update API (#24966)

* Flip meaning of parameter

* Update API (#24966)

* Remove all `ignoreJsDocComment` uses (fixes #25162)
2018-06-26 16:20:44 -07:00
王文璐 d5268c81e7 add quick fix for add missing enum member 2018-06-26 10:17:22 +08:00
Nathan Shively-SandersandGitHub 43d0794ba3 Fix crash when binding jsdoc-style inner namepaths (#25106)
* getDeclarationIdentifier handles undefined name

getNameOfDeclaration actually doesn't handle all declarations, only
those that produce names that could be reasonably used as an identifier.
Until now, getDeclarationIdentifier assumed that getNameOfDeclaration
always returned a name. This caused crashes whenever we tried to get the
name of something like a Constructor.

* Add test and baselines

* getNameOfDeclaration can return undefined

This requires all callers to handle it, which turns out now to be too
disruptive.

* Fix lint
2018-06-21 10:01:39 -07:00
Nathan Shively-SandersandGitHub 0f55566cf4 In JS, always check the extends tag of a class before its heritage clause (#25111)
* Check extends tag first in getClassExtendsHeritageClauseElement

Previously getBaseTypeNodeOfClass checked, but this is only used in a
few places.

* Fix names and add test

* Update API baseline

* Move jsdocAugments tests to conformance/jsdoc

* Better naming in checkClassLikeDeclaration
2018-06-20 16:28:30 -07:00
AndyandGitHub db85f37669 fixUnusedIdentifier: Don't needlessly exclude jsdoc (#25014) 2018-06-19 13:44:00 -07:00
Markus Johnsson aa87cc5b73 Merge branch 'master' of github.com:Microsoft/TypeScript 2018-06-19 11:18:20 +02:00