Commit graph

32715 commits

Author SHA1 Message Date
Gabriela Araujo Britto a52b84feeb add snippet sequence 2021-10-29 13:28:23 -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
csigs 566758d6cb
LEGO: Merge pull request 46566
LEGO: Merge pull request 46566
2021-10-28 10:13:44 -07:00
TypeScript Bot 4e237ed66f
🤖 Update TypeScript DOM Libs (#46222)
Co-authored-by: orta <orta@users.noreply.github.com>
2021-10-28 09:14:26 -07:00
TypeScript Bot 8173afbb8a Update package-lock.json 2021-10-28 06:06:31 +00:00
Daniel Rosenwasser f494742ce9
Check for array types when instantiating mapped type constraints with any (#46218)
* Added/updated tests.

* Accepted baselines.

* Update test.

* Update instantiateMappedType to work specially when 'any' replaced an array.

* Accepted baselines.

* Ensure check works when constraint is a union of arrayish types, just like in `Promise.all`.

* Accepted baselines.

* Update test for indirect instantiation of a mapped type.

* Accepted baselines.

* Update test comment.

* Accepted baselines.

* Added tuple test case.

* Accepted baselines.

* Don't add special behavior for tuples.

* Accepted baselines.

* Revert "Don't add special behavior for tuples."

This reverts commit f01ae16e65.

* Accepted baselines.
2021-10-27 15:03:01 -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
Zzzen 8a68c8616d
allow typeof this after for-loops (#46181) 2021-10-27 10:26:05 -07:00
Anders Hejlsberg f424dfc18a
Slightly less conservative check in isConstraintPosition (#46526)
* Slight adjustment to check in isConstraintPosition

* Add regression test
2021-10-26 11:54:46 -07:00
Anders Hejlsberg 44c63a757e
Always cache relations involving intersection types (#46523)
* Always cache relations involving intersection types

* Accept new baselines

* Add regression test
2021-10-26 09:36:19 -07:00
Anders Hejlsberg 658764e499
Bypass caching in removeStringLiteralsMatchedByTemplateLiterals (#46525)
* Bypass caching in removeStringLiteralsMatchedByTemplateLiterals

* Add regression test
2021-10-26 09:34:15 -07:00
TypeScript Bot e1a2c2c5a9 Update package-lock.json 2021-10-26 06:07:59 +00:00
Andrew Branch 3519af0bab
Fix crash pulling on global types before they're initialized (#46471)
* Add failing test

* Dumb fix

* Compute error message info more lazily

* One more laziness
2021-10-25 10:53:41 -07:00
csigs 6b6665e6ae
LEGO: Merge pull request 46520
LEGO: Merge pull request 46520
2021-10-25 10:13:29 -07:00
Adam Burgess 61f5ceb832
Fix isNewIdentifierLocation after generator (#46491) 2021-10-24 23:49:31 -07:00
csigs 7799113e9a
LEGO: Merge pull request 46510
LEGO: Merge pull request 46510
2021-10-24 22:14:38 -07:00
csigs e88e596126
LEGO: Merge pull request 46504
LEGO: Merge pull request 46504
2021-10-24 10:14:16 -07:00
csigs dd89e06520
LEGO: Merge pull request 46502
LEGO: Merge pull request 46502
2021-10-24 04:13:27 -07:00
csigs c2a4bda133
LEGO: Merge pull request 46501
LEGO: Merge pull request 46501
2021-10-23 22:14:29 -07:00
csigs 1055119164
LEGO: Merge pull request 46496
LEGO: Merge pull request 46496
2021-10-23 10:14:28 -07:00
TypeScript Bot cb07891d19 Update package-lock.json 2021-10-23 06:06:04 +00:00
Andrew Branch 907fc72db4
Fix auto import crash on weird JS aliasing (#46490)
* Fix auto import crash on weird JS aliasing

* Comment up the weird test

* Fix setting members on union/intersection type, happens later
2021-10-22 16:09:32 -07:00
Daniel Rosenwasser 334b8eaa57
Bind assignments to 'this' within static blocks in JS files (#46472)
* Add failing test case.

* Handle 'this' assignments on class static blocks in JavaScript.

* Accepted baselines.
2021-10-22 15:44:35 -07:00
Andrew Branch de1ac8191e
Fix isNewIdentifierLocation after async (#46485) 2021-10-22 12:28:04 -07:00
Oleksandr T ce676d0963
fix(46433): forbid using keywords as parameter names (#46459) 2021-10-22 09:58:01 -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
TypeScript Bot 65ae16cdea Update package-lock.json 2021-10-22 06:06:14 +00: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
Oleksandr T bd12ae2454
fix(46466): add missing async keyword before type parameters (#46467) 2021-10-21 15:56:45 -07:00
Andrew Casey 55b4928e82
Pass absolute path to directoryExists (#46086)
* Pass absolute path to directoryExists

As pointed out by @gretzkiy, the `directoryExists` call added to
`matchFiles` in #44710 should have been passing the absolute path (since
the current directory might not match `currentDirectory`).

* Add test, simplify/clarify/fix matchFiles and friends

Co-authored-by: Andrew Branch <andrew@wheream.io>
2021-10-21 12:22:53 -07:00
Warren Lu 5725cfeb10
Fix typos in es5.d.ts (#46321) 2021-10-21 11:59:01 -07:00
Andrew Branch 22f37cda85
Fix ordering of module specifiers based on package.json presence (#46437)
* Add failing test

* Fix ordering of module specifiers based on package.json presence
2021-10-21 11:43:57 -07:00
Nathan Shively-Sanders f2e5947935
@link parses trailing <...> as part of linkName (#46450)
Similar to #46428.

Fixes #44818
2021-10-20 17:01:01 -07:00
csigs 0d022130be
LEGO: Merge pull request 46451
LEGO: Merge pull request 46451
2021-10-20 10:13:33 -07:00
Nathan Shively-Sanders 98b4ac2cde
@link: format trailing () as part of linkName (#46428)
Parsing separates the identifier part of the link tag from its text, but
the editor should present an identifier followed by `()` as a single
identifier since people use that syntax as a function sigil.

I prefer `#'` personally, you know, xkcd 297, nudge nudge.
2021-10-20 08:36:40 -07:00
csigs 48e96f56be
LEGO: Merge pull request 46447
LEGO: Merge pull request 46447
2021-10-20 04:31:11 -07:00
TypeScript Bot dea48531f1 Update package-lock.json 2021-10-20 06:06:17 +00: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
csigs 53fa2a6494
LEGO: Merge pull request 46430
LEGO: Merge pull request 46430
2021-10-19 10:13:07 -07:00
Anders Hejlsberg 56b6279818
Improve logic for choosing between co- and contra-variant inferences (#46392)
* Improve logic for choosing between co- and contra-variant inferences

* Add tests
2021-10-19 09:58:10 -07:00
csigs fd6552a3c2
LEGO: Merge pull request 46424
LEGO: Merge pull request 46424
2021-10-19 04:15:18 -07:00
Eli Barzilay 556098ed50 Avoid hard-wired build-tree paths
Instead, search for stuff up the directory tree, with the main
functionality being to look for `Gulpfile.js` and assume the resulting
directory is the root.

(Unfortunatley, this is implemented twice, one in `scripts` and another
in `src`.  It's not possible to use a single implementation for both
since that would require assuming a directory structure which this is
intended to avoid.)

Also, in `scripts/build/projects.js`, abstracdt common exec
functionality into a local helper, and use full paths based on the above
search instead of assuming relative paths assuming CWD being in the
project root.
2021-10-18 17:43:45 -04:00
Eli Barzilay 7c3f607032 scripts/build/utils simplify exec
Using shell-based execution is always a bad idea; this thing didn't do
that via an option, but instead did it manually by constructing a shell
command so it suffers from the same diseases.

Perhaps there was need for this at some point in the past, but things
are pretty robust now, so there's no need to avoid running the command
normally.  The only thing that is needed is to add `which` which also
handles windows executable suffixes.

I tried this with a fresh clone on windows, where the tree and TS are
installed in paths that have spaces, and everything works as it should.
2021-10-18 17:43:19 -04:00
csigs 605788d4ab
LEGO: Merge pull request 46415
LEGO: Merge pull request 46415
2021-10-18 10:29:16 -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
TypeScript Bot 26aea0df61 Update package-lock.json 2021-10-17 06:07:02 +00:00
Eli Barzilay 39ff1568e9 Changes to enable the module conversion script
* shorthand -> long for `factory` since the typeformer script doesn't
  know how to handle it.

* Use setter to change `ts.sys` (similar to #35399).

* Fix `loggedIO` with empty namespaces to indicate dependency
  (similar to 50603eda).

* Move `Map` / `Set` stuff from `core.ts` to `corePublic.ts` since the
  types are there.
2021-10-16 08:12:59 -04:00
TypeScript Bot 506a95b5a5 Update package-lock.json 2021-10-16 06:06:14 +00:00
Sidharth Vinod dfb40549fc
fix: ES6 Modules => ES Modules in error messages (#46378)
* fix: ES6 Modules => ES Modules in error messages

* chore: Rename test file names

* chore: Rename function names
2021-10-15 14:51:14 -07:00
Nathan Shively-Sanders 6a75689a25
Import assertion: do no parse } if { is not present (#46388)
Previously, import assertion parsing would try to parse both { and },
even if both were missing. If both were missing, the error for } could
occur past the end of the file, causing an assertion.

Fixes #46364
2021-10-15 13:26:46 -07:00