Commit Graph

7318 Commits

Author SHA1 Message Date
Nathan Shively-Sanders
04ceb3d9bd Disallow JS/non-JS merge without crashing
Note that the error location is misleading because it's reported inside
the merge step for the js initializer.
2018-03-08 09:49:23 -08:00
Nathan Shively-Sanders
d86440f94f Merge branch 'master' into js-object-literal-assignments-as-declarations 2018-03-07 14:51:55 -08:00
Sheetal Nandi
36b45e3f13 Merge pull request #22343 from Microsoft/codeFixActionNotUndefined
Create the action only if the text change creation is successful.
2018-03-06 12:31:04 -08:00
Mohamed Hegazy
b2dd610e92 Fix ignore message indentation (#22340)
* Update baselines for user tests

* Add explicit indentation

* Fix https://github.com/Microsoft/TypeScript/issues/21355: Format `// @ts-ignore` added by quick fix

* Extract check to a separate function

* Consolidate checking for valid insert location

* Code review comments

* Do not return makeChange
2018-03-06 12:19:19 -08:00
Sheetal Nandi
70944428a1 Create the action only if the text change creation is successful. …
Make change for the infer type from usage could return undefined even if type is present if the type cannot be named
Fixes #22184
2018-03-06 11:03:20 -08:00
Sheetal Nandi
6f6c40186f Add test for undefined action returned
Test for #22343
2018-03-06 11:00:41 -08:00
Andy
a138985448 isValidMethodAccess: Instantiate signature this type if necessary (#21722) 2018-03-06 10:18:06 -08:00
Andy
e5f91f5948 Convert annotateWithTypeFromJSDoc refactor to a codefix (#22336)
* Convert annotateWithTypeFromJSDoc refactor to a codefix

* Compute isJsFile once at top
2018-03-06 07:49:21 -08:00
Priyantha Lankapura
ed1c5d9688 update test for #20577 (#22310) 2018-03-05 16:15:08 -08:00
Wesley Wigham
2f0a13c7c3 Use global NonNullable type for nonnull types (#22096)
* Use NonNullable type for nonnull types

* Add noLib test

* Remove conditional type fallback for when lib is not present
2018-03-05 14:52:06 -08:00
Andy
4ddf045d6a For <div a= >, after =, do not try to parse an expression (#21373) 2018-03-05 14:38:55 -08:00
Wesley Wigham
16bf02991d Allow indexing generics with unique symbols (#22339)
* Allow indexing generics with unique symbols

* Move condition to assert
2018-03-05 13:58:19 -08:00
Wesley Wigham
53ae507545 Add inference priority for mapped type keys (#22246)
* Add inference priority for mapped type keys

The new priority causes union inference, similarly to return type

* Rename priority

* Fix comment typo
2018-03-05 13:19:00 -08:00
Andy
2ac2291b84 Convert use-default-import refactor to a codefix (#22334) 2018-03-05 12:43:01 -08:00
Anders Hejlsberg
07ed899b46 Merge branch 'master' into checkInferredConstraints 2018-03-05 06:32:11 -08:00
Anders Hejlsberg
70818ae716 Merge pull request #22313 from Microsoft/fixDistributiveConditionalTypes
Fix distributive conditional types
2018-03-05 06:23:45 -08:00
Anders Hejlsberg
19e07eaea6 Add tests 2018-03-04 16:49:06 -08:00
Anders Hejlsberg
081a394927 Add regression test 2018-03-03 18:08:36 -08:00
Sheetal Nandi
6e756b5907 Merge pull request #22308 from Microsoft/declarationEmitOfIndirectAlias
Fix incorrect error reported when using type from indirect module alias and current module is exported with "export default"
2018-03-02 19:10:36 -08:00
Wesley Wigham
1c93744a9c Much better comment preservation (#22141)
* Retain comments on (and produce sourcemaps on) the equals token in initializers

* Improved comments/sourcemaps for await, yield, while, and for

* Retain comments on block curly-braces

* Emit comments for if statements

* Improved switch case comment emit

* Improve comment and sourcemap emit for try/catch, throw, and continue statements

* Improve sourcemap emit and comments for with statements

* More accurate sourcemaps+comments emit for new, typeof, void, and delete

* Improve comment emit for element access expressions

* Preserve more comments on imports and exports

* Make function a bit more defensive like other usages of emitTrailingCommentsOfPosition

* Support preserving comments within empty lists

* Handle leading comments of tokens, conditionally indent leading comments

* Stop heuristically sourcemapping tokens

When the transform was trivial it worked, but was unneeded, but when it was complex, it was brittle - best leave source mapping up to the transformers

* Fix unneeded +1

* Tighten up element access comments

* Handle comments on parenthesized expression tokens

* Fix nit
2018-03-02 17:23:59 -08:00
Yuichi Nukiyama
25525bc9d6 Change esnext.promise to es2018.promise (#22292)
* change esnest.promise to es2018.promise

* modify unit tests

* resolve conflict

* resolve conflict
2018-03-02 17:08:36 -08:00
Sheetal Nandi
dc7ee381d5 Add tests when declaration emit for indirect alias usuage results in wrong error reporting
Test for #22257
2018-03-02 16:10:34 -08:00
Anders Hejlsberg
2d5be24669 Merge pull request #22300 from Microsoft/distributeKeyofIntersection
Distribute 'keyof' intersection types
2018-03-02 16:08:20 -08:00
Andy
87c3cca3f0 Make convertFunctionToEs6Class a codefix (#22241)
* Make convertFunctionToEs6Class a codefix

* Change diagnostic message
2018-03-02 12:57:29 -08:00
Wenlu Wang
b15157356a add spelling suggestion support for module import (#22283) 2018-03-02 10:24:55 -08:00
Andy
dd27288e5a Don't rename static 'this' when renaming class (#22235) 2018-03-02 10:23:08 -08:00
Anders Hejlsberg
95bb156a3e Add tests 2018-03-02 09:26:52 -08:00
Benjamin Lichtman
dfa1a90b25 Merge pull request #22135 from uniqueiniquity/jsxFragmentHash
Allow characters in JsxText inside JsxFragment that usually don't scan
2018-03-01 16:50:09 -08:00
Andy
16fc256823 Convert 'installTypesForPackge' refactor to a suggestion (#22267)
* Convert 'installTypesForPackge' refactor to a suggestion

* Have checker collect a list of suggestion diagnostics instead of redoing work in calculateSuggestionDiagnostics

* Add comment

* Add diagnostic even with `--allowJs`
2018-03-01 14:41:55 -08:00
Andy
c12369b354 Fix bug where findAllReferences included a node outside of sourceFilesToSearch (#22062) 2018-03-01 13:44:53 -08:00
Yuichi Nukiyama
c7f65e8725 support groups property (#22176)
* support groups property

* fix option unittests
2018-03-01 12:58:25 -08:00
Andy
0a72568e59 findAllReferences: Make definition info independent of search location (#21748) 2018-03-01 12:46:00 -08:00
Anders Hejlsberg
bb05122a50 Merge pull request #22197 from Microsoft/fixConditionalTypes
Conditional type fixes
2018-03-01 10:27:15 -08:00
Andy
6385c66215 Simplify diagnostics fourslash tests (#22245) 2018-03-01 07:34:51 -08:00
Anders Hejlsberg
9c965aa691 Merge branch 'master' into fixConditionalTypes 2018-03-01 06:29:02 -08:00
Wesley Wigham
b8e0009c9b Set syntheticLiteralTypeOrigin on synthetic undefined-type members (#22216)
* Have getNameOfSymbolAsWritten quote nonidentifier nonnumeric symbols all the time

* Revert checker changes

* Reuse synthetic origin to indicate that derived declaration name may need to be quoted
2018-02-28 16:03:05 -08:00
Wesley Wigham
1a43ad01a7 Lookup JSX namespace within factory function (#22207)
* Lookup JSX namespace within factory function

* Rename functions
2018-02-28 15:48:33 -08:00
Wesley Wigham
62185673fd Emit unqiue symbols with typeof if possible before issuing an error (#21403) 2018-02-28 15:44:12 -08:00
Wesley Wigham
7a31192ecb Stop binding type predicate types twice (#22210) 2018-02-28 15:43:13 -08:00
Andy
fa4619c5c1 Add 'info' diagnostics (#22204)
* Add 'info' diagnostics

* Code review
2018-02-28 11:16:32 -08:00
Anders Hejlsberg
3fca99522b Update tests 2018-02-28 06:39:36 -08:00
Wesley Wigham
c1128d6957 Fix declaration emitted crash on mapped type with no type (#22213) 2018-02-27 16:12:03 -08:00
Anders Hejlsberg
c9c282b2d7 Update test 2018-02-27 15:15:08 -08:00
Nathan Shively-Sanders
c31808922d Remove assert for undeclared js-nested-exports
Previously, this would assert:

```ts
exports.undeclared.n = 1;
```

Because undeclared was never declared in any recognised way. Now it no
longer asserts, but does not bind. That's because the full pattern
starts with the line `exports = require('./x')` and assumes that x.js
declares `undeclared`. I am not sure how to bind this. The new test
contains this pattern in case I figure it out.
2018-02-27 15:04:10 -08:00
Nathan Shively-Sanders
c3143d2e47 Support js nested namespace decls on exports
and module.exports.
2018-02-27 10:20:16 -08:00
Wesley Wigham
32c63a2628 Add support for transpiling per-file jsx pragmas (#21218)
* Add support for per-file jsx pragmas

* Add error for using jsx factory pragma with fragments

* More tests, use different regex class for pragma capture

* Unify all pragma parsing machinery
2018-02-26 16:10:00 -08:00
Andy
0b1e21794d fourslash diagnostics tests: use objects instead of strings (#22193) 2018-02-26 14:55:26 -08:00
Anders Hejlsberg
b9e06bfd38 Merge branch 'master' into fixConditionalTypes
# Conflicts:
#	src/compiler/checker.ts
2018-02-26 14:50:23 -08:00
Anders Hejlsberg
3ad62ef3d6 Update tests 2018-02-26 14:26:26 -08:00
Wesley Wigham
0dc5f18bdb Remove excess comment ranges from initialized and property parameter emit (#22152) 2018-02-26 12:43:31 -08:00