3209 Commits

Author SHA1 Message Date
Collins Abitekaniza
7b55d1846b Giving too many arguments should error on the first argument that exceeds arity (#27982)
* span on first arg that exceeds arity

* refactor baseline

* handle cases for spread arguments

* refactor + add coverage for tuple spread cases

* create diagnostic on NodeArray of exceeding args

* test function overloading
2019-03-12 15:57:12 -07:00
Gabriela Britto
d2364f555f
Merge pull request #30089 from Microsoft/convert-to-named-parameters
Convert to named parameters
2019-03-06 09:33:01 -08:00
Gabriela Araujo Britto
8c4ab69d09 add test for non-transient symbol 2019-03-04 09:34:04 -08:00
Nathan Shively-Sanders
be2db9db12
Add globalThis (#29332)
* Restore original code from bind-toplevel-this

With one or two additional comments

* Working in JS, but the symbol is not right.

Still need to

1. Make it work in Typescript.
2. Add test (and make them work) for the other uses of GlobalThis:
window, globalThis, etc.

* Check in TS also; update some tests

Lots of tests still fail, but all but 1 change so far has been correct.

* Update baselines

A couple of tests still fail and need to be fixed.

* Handle type references to globalThis

The type reference must be `typeof globalThis`. Just `globalThis` will
be treated as a value reference in type position -- an error.

* Restore former behaviour of implicitThis errors

I left the noImplicitThis rule for captured use of global this in an
arrow function, even though technically it isn't `any` any more --
it's typeof globalThis.  However, you should still use some other method
to access globals inside an arrow, because captured-global-this is super
confusing there.

* Test values with type globalThis

I ran into a problem with intersecting `Window & typeof globalThis`:

1. This adds a new index signature to Window, which is probably not
desired. In fact, with noImplicitAny, it's not desired on globalThis
either I think.
2. Adding this type requires editing TSJS-lib-generator, not this repo.

So I added the test cases and will probably update them later, when
those two problems are fixed.

* Add esnext declaration for globalThis

* Switch to symbol-based approach

I decided I didn't like the import-type-based approach.

Update baselines to reflect the difference.

* Do not suggest globals for completions at toplevel

* Add tests of element and property access

* Look up globalThis using normal resolution

globalThis is no longer constructed lazily. Its synthetic Identifier
node is also now more realistic.

* Update fourslash tests

* Add missed fourslash test update

* Remove esnext.globalthis.d.ts too

* Add chained globalThis self-lookup test

* Attempt at making globalThis readonly

In progress, had to interrupt for other work.

* Add/update tests

* Addres PR comments:

1. Add parameter to tryGetThisTypeAt to exclude globalThis.
2. Use combined Module flag instead combining them in-place.
3. SymbolDisplay doesn't print 'module globalThis' for this expressions
anymore.
2019-02-27 14:14:34 -08:00
王文璐
4d7ec380a9 check completions with assignable rather than identity 2019-02-26 10:54:01 +08:00
Gabriela Araujo Britto
a5153a94ab add tests 2019-02-25 14:14:28 -08:00
Gabriela Araujo Britto
365967d484 Merge branch 'master' into convert-to-named-parameters 2019-02-25 10:54:58 -08:00
Gabriela Araujo Britto
f571866f47 add new tests for bad class references 2019-02-25 10:32:56 -08:00
Gabriela Araujo Britto
bc3611d1dd update failing tests 2019-02-25 10:32:28 -08:00
Joseph Wunderlich
21ab39649c remove any annotation from declare method quickfix 2019-02-22 17:24:21 -08:00
Gabriela Araujo Britto
6b53489a4a Merge branch 'master' into convert-to-named-parameters 2019-02-20 13:24:09 -08:00
xiaofa
7c8c6cf4d0 fix no space before equal operator in type parameter 2019-02-20 18:12:09 +08:00
Gabriela Araujo Britto
754f4a45b6 refactor expected test output 2019-02-19 14:23:26 -08:00
Gabriela Araujo Britto
edf0cec3dd add tests for inherited constructor and method 2019-02-19 14:22:59 -08:00
Gabriela Araujo Britto
a773046181 copy argument comments to property 2019-02-15 16:48:54 -08:00
Gabriela Araujo Britto
b93afffaf7 rename refactor tests 2019-02-15 15:36:11 -08:00
Gabriela Araujo Britto
dbd84996aa don't apply refactor when parameter has decorators 2019-02-11 14:24:05 -08:00
Gabriela Araujo Britto
4e135f13b5 add tests for comments 2019-02-11 12:03:09 -08:00
Gabriela Britto
9270e58eaf Merge branch 'master' into convert-to-named-parameters 2019-02-06 15:41:16 -08:00
Gabriela Britto
1d1c82095c add tests for rest parameters 2019-02-04 12:53:02 -08:00
Gabriela Britto
abb11550d3 add more tests 2019-02-01 16:44:22 -08:00
Ryan Cavanaugh
a856a64a5c
Merge pull request #29446 from fuafa/infer-js-doc
fix quick fix infer parameter types from usage in js file
2019-02-01 13:55:31 -08:00
Gabriela Britto
40987ecf41 add tests 2019-01-29 16:53:38 -08:00
Gabriela Britto
050c70a4c0 update tests formatting 2019-01-29 16:45:52 -08:00
Gabriela Britto
9e62eb9fb4 Merge branch 'master' into convert-to-named-parameters 2019-01-28 16:00:47 -08:00
Gabriela Britto
b668e342c4 Add tests for convert to named parameters refactor 2019-01-28 15:53:39 -08:00
xiaofa
ddbac8f3fe get appropriate parent jsdoc node for arrow functions 2019-01-26 23:59:32 +08:00
Wesley Wigham
d16cf761ba
Move random file in root into test folder (#29575) 2019-01-24 17:33:12 -08:00
Sheetal Nandi
73fe3fc0f5
Merge pull request #29532 from Microsoft/umdModuleGlobalMerge
Handle find all references for symbol merged with UMD module and global var
2019-01-23 11:13:58 -08:00
Sheetal Nandi
d42185373a PR feedback 2019-01-23 10:48:17 -08:00
Ron Buckton
76b78a4df5 Fix crash in signatureHelp 2019-01-22 15:02:30 -08:00
Sheetal Nandi
f0227ecb2c Handle find all references for symbol merged with UMD module and global var
Fixes #29093
2019-01-22 14:52:39 -08:00
Gabriela Britto
bd290e6eed add test for convert to named parameters refactoring 2019-01-18 16:54:57 -08:00
Andrew Casey
737fda928c Don't treat interfaces as implementations
...even if they're in ambient contexts.  Same for type aliases.
2019-01-17 15:45:01 -08:00
Wesley Wigham
045a450972
Merge branch 'fix-generic-types-intersections' of git://github.com/flapenguin/TypeScript into flapenguin-fix-generic-types-intersections 2019-01-17 10:49:04 -08:00
Andrew Casey
94ca50177a
Merge pull request #29451 from amcasey/GH27937
Consider JSX namespace imports when moving statements between files
2019-01-17 10:19:02 -08:00
Andrew Casey
4029e70c97 Illustrate a case that isn't handled correctly 2019-01-16 19:24:51 -08:00
Andrew Casey
3e256e14dc Add fourslash tests 2019-01-16 19:18:25 -08:00
xiaofa
c9c9f859f3 fix quick fix infer parameter types from usage in js file 2019-01-17 05:51:57 +08:00
Benjamin Lichtman
5fc8f1dd80
Add opt-in user preference for prefix and suffix text on renames (#29314)
* Add user preference to control renaming through exports

* Only impact renaming

* Update baselines

* Use flag to control all prefix and suffix text and imports

* [WIP] add tests

* Only skip export import specifier with flag

* [WIP] Update tests

* Update test

* Pick up preference from host and update test

* Shorten flag name

* Add missing utility function

* Update comment

* [WIP] rename flag and respond to cr

* [WIP] Add flag for forRelatedSymbol

* Use larger search symbol set for old-style rename

* Respond to CR

* Fix small error

* Fix type mismatch

* Update comment and remove unnecessary exprot

* Respond to CR
2019-01-16 10:58:07 -08:00
Daniel Rosenwasser
9cd5f2dd3c Add regression test. (#29433) 2019-01-15 17:39:02 -08:00
Benjamin Lichtman
c5948bf068
Merge pull request #29385 from uniqueiniquity/renameImportPref
Add user preference to opt-in to renaming import paths
2019-01-15 10:29:57 -08:00
Sheetal Nandi
d53619a30d
Merge pull request #29418 from Microsoft/exportEquals
Handle generating action for export equals with anonymous symbol
2019-01-14 16:12:32 -08:00
Sheetal Nandi
6e54cbdaff Handle generating action for export equals with anonymous symbol
Fixes #28845
2019-01-14 15:32:13 -08:00
Wesley Wigham
3d2bf6a75f
Fix implement interface quickfix import types (#29410)
* Pass module specifier resolution host thru types constructed by implements quickfixes

* Add regression test

* Fix scope node for generated methods, fix lints
2019-01-14 13:56:27 -08:00
Benjamin Lichtman
d029fae35c Add user preference to opt-in to renaming import paths 2019-01-11 14:45:08 -08:00
Josh Goldberg
8d28f9230c Added codefix to enable experimentalDecorators in the user's config file
Starts on #29035 by creating a codefix to enable the `experimentalDecorators` setting in a user's config file, if one exists. The issue's discussion also mentions giving a more precise error message if the user has a jsconfig or tsconfig or creating one if not; I'd rather tackle those in separate PRs to keep this one small.

Doesn't create the code action if no config file is present. Otherwise keeps to the precedent of returning without action when the config file contents aren't the expected JSON structure (looking at `fixCannotFindModule.ts`).  Moves a couple JSON helpers from that file into the sibling `helpers.ts` so both codefixes can use them.
2019-01-11 09:20:12 -05:00
Sheetal Nandi
3f5c0b81a3 Fix existing test 2019-01-09 10:28:53 -08:00
Sheetal Nandi
d8ee4116ef Fix function declaration without body to be checked as context sensitive
Fixes #29032
2019-01-03 12:46:39 -08:00
Benjamin Lichtman
11585d29bc
Merge pull request #29218 from uniqueiniquity/jsdocSpanForVarStatement
Jsdoc span for var statement
2018-12-31 16:27:34 -08:00