Nathan Shively-Sanders
ca94d8efd9
Infer from usage better import types ( #27626 )
...
* Use host to improve SymbolTracker implementation
* inferFromUsage: Provide a better moduleResolverHost
This produces better paths on import types.
2018-10-09 07:12:09 -07:00
Benjamin Lichtman
2ebd986d99
Always await expression of promise type in return position
2018-10-05 09:59:22 -07:00
Alessandro Vergani
bbf77538c4
Remove unneeded check from getTransformationBody
...
Remove unneeded `argName` check, because it always evaluates to `true` (the `false` case is handled just before the modified line)
2018-10-02 16:02:04 +02:00
Benjamin Lichtman
f356cd6c89
Insert async keyword as last modifier ( #27491 )
2018-10-01 17:43:17 -07:00
Dhruv Rajvanshi
bde81deed2
Issue #27301 : Fixed crash when converting function to async ( #27396 )
2018-09-27 18:56:37 -07:00
Andy
0a97663843
Add 'prefixText' and 'suffixText' when renaming shorthand properties ( #27356 )
...
* Add 'prefixText' and 'suffixText' when renaming shorthand properties
* Make prefixText and suffixText missing instead of undefined
* Fix test
2018-09-26 16:58:01 -07:00
Andy
5f563c99f6
convertToAsyncFunction: Use ReadonlyArray / ReadonlyMap where possible ( #27190 )
2018-09-20 16:45:28 -07:00
Andy
c57ff087d6
Add codefix to generate types for untyped module ( #26588 )
2018-09-18 11:47:29 -07:00
Benjamin Lichtman
b484370dcc
Clean up for type precision and clarity
2018-09-18 09:34:08 -07:00
Benjamin Lichtman
0cb9fd62ba
Merge branch 'master' into promisesAndUnderscores
2018-09-17 16:43:08 -07:00
Benjamin Lichtman
b2378ca40c
Stop adding name of function being fixed and update baseline
2018-09-17 16:33:32 -07:00
Benjamin Lichtman
a73b561dd3
Ensure name for callback is generated even when it has no args
2018-09-17 16:23:47 -07:00
Benjamin Lichtman
0995869377
Stop creating empty identifier name
2018-09-17 15:53:15 -07:00
Benjamin Lichtman
1a3ff452c1
Respond to CR
2018-09-17 15:44:08 -07:00
Andy
4e3e8f5ea7
convertToAsyncFunction: Reduce casts in getTransformationBody ( #27158 )
2018-09-17 15:23:44 -07:00
Benjamin Lichtman
830b387765
No longer specially recognize underscore and update baselines
2018-09-17 14:34:31 -07:00
Benjamin Lichtman
1b9507ad06
Wrap expressions returned from promises in awaits when appropriate
2018-09-17 11:33:28 -07:00
Benjamin Lichtman
f9072621a9
Run callback as expression statement when no arg to assign to exists
2018-09-17 09:48:19 -07:00
Wesley Wigham
20eafb5b74
Introduce boolean literal freshness ( #27042 )
2018-09-14 15:00:09 -07:00
Benjamin Lichtman
0e985eb342
Merge branch 'master' into asyncCatchUniqueNames
2018-09-14 09:50:27 -07:00
Benjamin Lichtman
98055ad540
Use separate map with smaller scope to track renames
2018-09-14 09:46:58 -07:00
Benjamin Lichtman
13deedf841
Merge pull request #26930 from uniqueiniquity/onlyReportExpectedPromiseArgs
...
Only perform async code fix if it can successfully refactor all parts
2018-09-14 09:41:34 -07:00
Benjamin Lichtman
57a6dbd6fa
Add clarifying comments
2018-09-14 08:50:18 -07:00
Benjamin Lichtman
e700022cef
Remove unnecessary case
2018-09-13 09:46:40 -07:00
Benjamin Lichtman
d12110d3e5
Respond to CR
2018-09-13 09:32:38 -07:00
Benjamin Lichtman
905578cf37
Use existing identifier when possible for renaming functions
2018-09-13 09:02:02 -07:00
Benjamin Lichtman
906fbae37b
Handle promise handler block bodies with no return and other cleanup
2018-09-12 14:47:06 -07:00
Nathan Shively-Sanders
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
Benjamin Lichtman
92edc2db56
[WIP] Record original name of renamed variable
2018-09-11 11:12:11 -07:00
Benjamin Lichtman
a4c87df821
[WIP] Use original identifier name to count up from when renaming collisions
2018-09-11 11:12:11 -07:00
Benjamin Lichtman
8c9e8666ed
Miscellaneous cleanup
2018-09-11 11:12:10 -07:00
Benjamin Lichtman
95d57885c5
Ensure diagnostic reporting matches code fix ability
2018-09-07 14:14:01 -07:00
Ron Buckton
a255d9a163
Merge branch 'master' into typesVersions
2018-09-07 13:52:12 -07:00
Benjamin Lichtman
f7f5b1ac87
Don't case on type node
2018-09-05 16:28:53 -07:00
Benjamin Lichtman
5a72da76c2
Only perform async refactor if it won't delete code
2018-09-05 16:27:14 -07:00
Andy
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 Lichtman
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
Andy
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
Andy
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
Andy
552bd1c8a2
Support import fix/completions for export = ( #25708 )
2018-08-28 13:04:11 -07:00
Andy
4cf5774c5e
Add tsserver test for completions and avoid excess properties ( #25622 )
2018-08-27 16:04:02 -07:00
Wenlu Wang
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 Dinella
421730a68d
Refactoring promises returning functions to use async and await ( #26373 )
2018-08-10 16:11:45 -07:00
Andy
4bb740218d
getDefaultExportInfo: Use getImmediateAliasedSymbol instead of getAliasedSymbol ( #26364 )
2018-08-10 14:35:18 -07:00