Commit Graph

28909 Commits

Author SHA1 Message Date
Nathan Shively-Sanders 53bb4e84a2 Better checking of assignment declarations (#28387)
Previously, type checking was turned off for all assignment
declarations. This is a problem when the declarations are annotated with
jsdoc types.

This PR checks assignment declarations, *except* for expando
initialisers. Expando initialisers are

1. Empty object types.
2. Function types.
3. Class types.
4. Non-empty object types when the assignment declaration kind is
prototype assignment or module.exports assignment.
2018-11-15 08:46:11 -08:00
Nathan Shively-Sanders 7a7328a17f string|number inferences are low priority (#28381)
* string|number inferences are low priority

Also, refactor unifyFromContext to explicitly handle priorities

* string/number/strnum are not mutually exclusive

* Assert that high/low can't apply to same element
2018-11-15 08:32:28 -08:00
Andy 2600250a24 Add 'bigint' to type keywords (#28537) 2018-11-14 22:18:05 -08:00
Daniel Rosenwasser fe263708be Merge pull request #27019 from iliashkolyar/codefix_add_missing_new_operator
Codefix: add quick fix for missing 'new' operator
2018-11-14 16:53:25 -08:00
Andy Hanson 643678bb54 generateGetAccessorAndSetAccessor: Don't use FindAllReferences 2018-11-14 15:05:46 -08:00
Aziz Khambati 24759b81e6 Fix comments after sread expression, spread assignment (#28482) 2018-11-14 14:20:07 -08:00
Andy da37457c72 When renaming an imported symbol, rename only in current file (#28406)
* When renaming an imported symbol, rename only in current file

* Improve re-export references

* Remember to use 'range' in for loop

* Uncomment tests
2018-11-14 09:09:00 -08:00
Daniel Rosenwasser f4fb28daa9 Merge pull request #28015 from prateekgoel/error-messages
Error messages for extending a specific type
2018-11-13 17:04:40 -08:00
TypeScript Bot 89fbaf211c Update user baselines (#28504) 2018-11-13 15:56:49 -08:00
Wesley Wigham 7a71887c23 Build better import paths for declaration emit/typeToString from reexports if possible (#27340)
* Build better import paths from reexports if possible, issue error on node_modules import generation

* Small refactorings

* Add file-by-file cacheing

* Minor cleanups

* Adjust error message
2018-11-13 14:07:54 -08:00
Daniel Rosenwasser 12e371beaa Merge pull request #28313 from a-tarasyuk/feature/28297-make-error-message-at--a-constant-or-a-read-only-property--more-specific
Feature/28297 make error message at  a constant or a read only property  more specific
2018-11-13 11:42:13 -08:00
AnyhowStep dd3ed02868 Removed stray whitespace 2018-11-13 12:24:03 -05:00
Sheetal Nandi bc5668ee4b Merge pull request #28496 from calebsander/fix/remove-unused-baselines
Remove unused baselines
2018-11-13 05:12:55 -08:00
Alexander T d3d211486c update baseline after merge the latest changes from master 2018-11-13 10:14:43 +02:00
Alexander T 5c7f8ef89d Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/28297-make-error-message-at--a-constant-or-a-read-only-property--more-specific 2018-11-13 09:58:30 +02:00
Wesley Wigham 004dc89600 Use elipses for reverse mapped types in nested positions (#28494) 2018-11-12 18:50:08 -08:00
Caleb Sander e7a03bc242 Remove no longer used baselines 2018-11-12 18:07:37 -08:00
Wesley Wigham d99de73e85 Handle type argument lists as jsx completion starts (#28493)
* Handle type argument lists as jsx completion starts

* preceeding -> preceding
2018-11-12 16:30:04 -08:00
Daniel Rosenwasser 40bd7c89ab Update LKG. 2018-11-12 16:27:38 -08:00
Daniel Rosenwasser 25462beeb7 Merge pull request #28456 from Microsoft/nonExperimentalBigInt
BigInt shouldn't be considered experimental
2018-11-12 15:59:15 -08:00
Wesley Wigham 2b345cc8f8 Track type recusion and symbol instantiation depth seperately in createAnonymousTypeNode (#28490) 2018-11-12 15:45:36 -08:00
Daniel Rosenwasser 624fdcb0bd git rm file; not sure how we missed that. 2018-11-12 15:30:06 -08:00
Daniel Rosenwasser cd5928a980 Accepted baselines. 2018-11-12 14:52:44 -08:00
Daniel Rosenwasser 9e92597ae7 More general test case name. 2018-11-12 14:52:44 -08:00
Daniel Rosenwasser e4bb1973ed Fixed up flags on test cases and stray newline. 2018-11-12 14:52:44 -08:00
Daniel Rosenwasser 830be0651c Merge pull request #27669 from Microsoft/betterErrorForAccidentalCall
Always emit diagnostic when a call expression can be fixed by adding a semicolon
2018-11-12 14:50:23 -08:00
Daniel Rosenwasser 7ff12a2f77 Merge pull request #28255 from leonaves/patch-1
Fix broken twitter link in README
2018-11-12 14:45:23 -08:00
Wesley Wigham 13234b62f5 Force inner indexed access simplification during inference, if possible (#28420)
* Force inner indexed access simplification during inference, if possible

* rename

* Refactor to used shared implementation of distribution
2018-11-12 14:39:43 -08:00
Andy 995f746c92 Add implicit-any error on JSDocFunctionType with no return type (#28487) 2018-11-12 14:39:02 -08:00
Wesley Wigham 11eee2b6ee Slightly improve missing property errors (#28298)
* Slightly improve missing property errors

* Add missing quote

* Fix jsx case

* Add related span

* Fix crash (why can declarations be undefined)

* Only skip top elaboration when no variant message is provided
2018-11-12 14:31:15 -08:00
Wesley Wigham eb21eb8e11 Ensure all default type params are mapped to some default even in circular scenarios (#28423)
* Ensure all default type params are mapped to some default even in circular scenarios

* Add js example, fix typo
2018-11-12 13:52:47 -08:00
Klaus Meinhardt 5acf8e380b fix lint 2018-11-12 21:47:50 +01:00
Klaus Meinhardt b55b6e2f6b fix comment parsing at start of file
* skip shebang if present (fixes: #28477)
* don't parse trailing comments as they are also treated like leading comments
2018-11-12 21:45:36 +01:00
Andy fe1ba9bee3 Improvements to generateTypes (#28458)
* Improvements to generateTypes

* createProperty only if necessary
2018-11-12 11:50:48 -08:00
Sheetal Nandi b8968fa0e4 Merge pull request #28485 from Microsoft/conditionalTypeDecorator
When serializing conditional types, use true and false type to determine emit
2018-11-12 09:47:51 -08:00
Andy 0077016c63 Reduce duplicate code in getListByRange (#28455) 2018-11-12 09:43:40 -08:00
Sheetal Nandi d569743640 Merge pull request #28194 from iliashkolyar/add_missing_apostrophe_in_codefix
Add missing apostrophe to codefix suggestion
2018-11-12 09:31:24 -08:00
Sheetal Nandi cce26c8ff1 When serializing conditional types, use true and false type to determine emit
Fixes #27999
2018-11-12 09:23:29 -08:00
Sheetal Nandi 63939d16e0 Merge pull request #28473 from ajafff/test-jsdoc-importtype-resolution
Add test for #28468
2018-11-12 08:36:36 -08:00
Sheetal Nandi c09e042243 Merge pull request #28478 from mita4829/master
Fix spelling mistake in a comment for commandLineParser.ts
2018-11-12 08:34:05 -08:00
Michael Tang 4e0bb7a80a Fix typo comment 2018-11-11 19:03:46 -08:00
Kagami Sascha Rosylight 7017d1a9ef Merge branch 'master' into async-es2018 2018-11-12 11:04:21 +09:00
Klaus Meinhardt 3dfd9c1b9b Add test for #28468 2018-11-11 18:47:02 +01:00
Alan Pierce 293eba6203 Change isolatedModules to allow const enum declaration and disallow access
Fixes #20703 with solution suggested in https://github.com/Microsoft/TypeScript/issues/20703#issuecomment-361434795

Previously, `--isolatedModules` gave an error for any ambient const enum, which
meant that some third-party libraries would always give errors even if the
ambient const enums they declare were never used. Now, we only give an error
when an ambient const enum is referenced, which allows such libraries to still
be used as long as the const enums are never accessed.

Some nuances:
* As before, the error is only surfaced for *ambient* const enums. With
  non-ambient const enums, we know that an `isolatedModules` build will emit the
  enum and produce a plain reference rather than inlining the constant, so
  everything will still work.
* I originally planned to do this check in the code path that inlines the
  constant, but that code is only exercised at emit time, so, for example, the
  TS language service wasn't giving an error in my editor. Instead, I do the
  check at typecheck time next to another const-enum-related check.
* This can be a breaking change when using `skipLibCheck` because the error is
  typically moved from a .d.ts file to a .ts file.

Testing done:
I ran this TS build on a large project of mine that previously had disabled
`isolatedModules` so I could use the `chalk` library. With `isolatedModules`
enabled, there was no longer an error in the chalk typedefs, and a reference to
the `Level` const enum produced an error in my editor.
2018-11-10 14:47:05 -08:00
Anders Hejlsberg a2205ad53d Merge pull request #28429 from Microsoft/fixEmptyObjectIntersection
Fix empty object intersections
2018-11-10 00:44:57 -08:00
TypeScript Bot 15d28d6c8e Update user baselines (#28457) 2018-11-09 17:54:23 -08:00
Sheetal Nandi b0d85c0270 Merge pull request #28450 from Microsoft/libErrors
Remove lib file errors from builder cache when global files are to be emitted
2018-11-09 17:42:08 -08:00
Wesley Wigham 7d4e0e6297 Fix duplicated amd module comments in declaration bundle (#28451) 2018-11-09 17:18:34 -08:00
Sheetal Nandi 1b8bfc832a Check modifiers on variable like declarations only 2018-11-09 17:13:39 -08:00
Daniel Rosenwasser 146afddae1 Accepted baselines. 2018-11-09 17:09:16 -08:00