1486 Commits

Author SHA1 Message Date
Ron Buckton
354e0c40ed Merge branch 'master' into removeWhitespace 2018-08-14 14:26:45 -07:00
Elizabeth Dinella
421730a68d
Refactoring promises returning functions to use async and await (#26373) 2018-08-10 16:11:45 -07:00
Ryan Cavanaugh
3fde17e85c
Merge pull request #26234 from RyanCavanaugh/noVoidTest
Disallow expressions of type `void` to be used in truthiness checks
2018-08-07 08:37:42 -07:00
Anders Hejlsberg
cfa29ae2fa Merge branch 'master' into fixCircularReturnType
# Conflicts:
#	src/compiler/diagnosticMessages.json
2018-08-06 10:53:20 -07:00
Anders Hejlsberg
6a17f4d162 Merge branch 'master' into fixCircularReturnType
# Conflicts:
#	tests/baselines/reference/recursiveResolveDeclaredMembers.types
#	tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.types
2018-08-06 10:42:35 -07:00
Alexander T
37b9a6bca4 25840 - Add a more meaningful error message to the case when calling a public static method on an instance (#25922)
* add a more meaningful error message to the case when calling a public static method on an instance

* Fix tests
2018-08-06 10:24:48 -07:00
Ryan Cavanaugh
14d3c69c72 Disallow exprs of type void to be used in truthiness checks 2018-08-06 09:40:22 -07:00
Anders Hejlsberg
e4443bb993 Properly catch and error on circular function return types 2018-08-03 14:03:30 -07:00
Ron Buckton
5bdadb261b Merge branch 'master' into removeWhitespace 2018-08-02 11:06:27 -07:00
Ron Buckton
108b1b4a71 Update diagnostic message code 2018-08-01 16:17:08 -07:00
Ron Buckton
73b826ca21 Merge branch 'master' into removeWhitespace 2018-08-01 15:35:39 -07:00
Matt McCutchen
d054621477 "Could not find a declaration file for module" error needs to use the
unmangled package name where appropriate.

Add a test case for an untyped sub-module of a scoped package with
typings.  The other diagnostic message is covered by existing tests; I
guess no one looked at the baselines closely enough.

Fixes #23999.
2018-08-01 14:13:38 -04:00
Andy
f326b4b7cb
Make import fix for default import mention that it's a default import (#26105) 2018-07-31 17:28:35 -07:00
Andy
d40d54984e
Support deleting all unused type parameters in a list, and deleting @template tag (#25748)
* Support deleting all unused type parameters in a list, and deleting @template tag

* Support type parameter in 'infer'
2018-07-27 11:55:31 -07:00
Daniel Rosenwasser
64d01d8e8f Provide a better error on arrow functions that capture the global 'this'. 2018-07-26 11:51:04 -07:00
Sheetal Nandi
d920efe3f9 Merge branch 'master' into resolveJsonModuleError 2018-07-25 17:32:22 -07:00
Sheetal Nandi
dfb5cbd373 When json module is not found, include enabling --resolveJsonModule might help.
Fixes #25722
2018-07-25 16:20:37 -07:00
Matt McCutchen
da64479a64 Improve the error message when asserting to a type that is not
comparable to the original.

Also improve the error message for implicit conversion of a symbol to a
string in a template literal, which previously shared the error message
with type assertions.

Fixes #25539.  Addresses #25870.
2018-07-25 19:13:10 -04:00
Matt McCutchen
f72193eedc Report a semantic error for an arrow function with a "this" parameter.
Fixes #9744.
2018-07-23 10:42:56 -04:00
Wenlu Wang
ed8b76424e add grammar check for labeled declaration (#25317)
* add grammar check for labeled function declaration

* fix debug failed on labeled class declaration

* move labeled statement check to binder and add more pattern for check

* update diagnostic message

* update baseline
2018-07-18 15:37:27 -06:00
Andy
f500289a44
Stricter test that JSDoc @type tag matches function signature (#25615) 2018-07-12 14:02:02 -07:00
Nathan Shively-Sanders
bd7b97ce61
Get return type from @type tag (#25580)
* Get return type from `@type` tag

This only happens in the checker, where the type is easily accessible.
The syntax-based check in getEffectiveReturnTypeNode as a fast path, and
for other uses that don't want to make a call to getTypeFromTypeNode.

Fixes #25525

* Implement PR suggestions

* Error when type tag isn't callable

* Fix lint
2018-07-12 10:49:41 -07:00
rflorian
66e9aaac18 Issue 19220 function parameter arity (#24031)
* Added reference test case and diagnostics message

* Adjusted arity checks to account for non-contiguous overloads

* Code cleanup, baseline not yet commited

* Accepted test baselines and minor implementation changes

* Cleaned up baseline tracking the now renamed arity check test

* Add range response when range contains only 2 values

* Added recent baseline

* Refined arity error messages when available overloads can be grouped

* Rolled back code formatting

* WIP cleanup needed in a few edge cases

* Finished adding new more descriptive error messages

* Code cleanup

* Added simplified version of bugfix for #19220

* Rebased onto master

* Removed whitespace after type assertion

* Code review simplifications

* Use correct diagnostic name

* Code review changes and simplification of diagnostic message

* Revert formatting changes
2018-07-11 17:19:56 -07:00
Sheetal Nandi
3866a5048b Report errors for module generation other than "commonjs" with --resolveJsonModule
Fixes #25517
2018-07-10 15:00:46 -07:00
Ron Buckton
c22cca462a Merge branch 'master' into removeWhitespace 2018-07-06 17:13:28 -07:00
Ron Buckton
7df8091a84 Add whitespace-removing text writer 2018-07-06 15:17:50 -07:00
Daniel Rosenwasser
b93845ae51 Switch from 'Error' to 'Message' on related span messages. 2018-07-05 20:34:28 -07:00
Daniel Rosenwasser
5afc8fdcef Add a related span for suggested declaration locations in error messages. 2018-07-05 18:49:43 -07:00
Alexander T
f851ab8f3e Add a suggestion - Did you mean 'typeof import()?. Add tests to handle undated error message 2018-07-04 16:04:29 +03:00
Wesley Wigham
84f5aa540e
Put error spans deep on nested object literals (#25140)
* Add ncie deep elaborations

* Nice stuff

* Modify tuple error to use length error mroe often

* Accept good baselines

* Accept meh baselines

* Fix literal types

* Calculate elaborations like it was the very first time again~

* Use tristate for enum relationship to ensure elaborations are printed at least once

* Update message text, nits

* move some functions back to where they were

* Add test of deep JSX elaboration

* Add elaboration test with parenthesized expressions, comma expressions, and assignments

* Move check to allow elaborations on more anonymous types

* Fix nits

* Add specialized error to elaborations of nonliteral computed named-members

* Update error message
2018-07-03 19:40:58 -07:00
Andy
064ecd449e
Support code-fix-all for importFixes (#25137)
* Support code-fix-all for importFixes

* Change description

* Update API (#25283)
2018-07-03 15:19:15 -07:00
Alexander T
6ff0ba644b Add new error message - Property {0} is used before its initialization. 2018-07-03 14:39:58 +03:00
Mohamed Hegazy
956f9d0be2
Merge pull request #25335 from Microsoft/codeFixAddMissingEnumMember_all
Combine code-fix-all for missing class member and missing enum member
2018-07-02 15:14:19 -07:00
Daniel Rosenwasser
4459730e5b Give related error on declaration location for used-before-declared errors. 2018-07-02 11:32:20 -07:00
Wesley Wigham
7084e6cf47
Adds related spans and error grouping for duplicate identifier errors (#25328)
* Adds related spans and error grouping for duplicate identifier errors

* Trim trailing whitespace

* Record related info in error baselines

* Make error more whimsical
2018-07-02 10:47:52 -07:00
Andy Hanson
2fa27ffdf7 Combine code-fix-all for missing class member and missing enum member 2018-06-29 19:39:19 -07:00
Daniel Rosenwasser
b5f386eb6e
Merge pull request #25311 from Microsoft/betterAlwaysTrueFalseErrors
Even better "always true/false" errors
2018-06-29 14:07:04 -07:00
Mohamed Hegazy
c27dace3df
Merge pull request #25182 from Kingwl/fix-missing-enum-member
add quick fix for add missing enum member
2018-06-29 10:19:23 -07:00
Daniel Rosenwasser
6f06fd0d46 Use a more direct error. 2018-06-28 16:06:55 -07:00
Daniel Rosenwasser
1f8ad2d318 indicates -> indicate 2018-06-27 17:20:24 -07:00
Daniel Rosenwasser
63a52cd21e Give a better message up-front for incompatible equality errors. 2018-06-26 15:11:41 -07:00
王文璐
a62a54df57 Merge branch 'master' into fix-missing-enum-member 2018-06-26 10:30:09 +08:00
Anders Hejlsberg
70975cd08f
Merge pull request #24897 from Microsoft/restTuples
Tuples in rest parameters and spread expressions
2018-06-25 19:26:35 -07:00
王文璐
d5268c81e7 add quick fix for add missing enum member 2018-06-26 10:17:22 +08:00
Andy
806a661be3
Add refactor to convert named to default export and back (#24878)
* Add refactor to convert named to default export and back

* Support ambient module

* Handle declaration kinds that can't be default-exported

* Update API (#24966)
2018-06-25 10:34:24 -07:00
Anders Hejlsberg
28c9f5933a Complete support for rest elements in tuples 2018-06-24 14:32:41 -10:00
Anders Hejlsberg
b0d8c6551e Merge branch 'master' into restTuples
# Conflicts:
#	src/compiler/checker.ts
2018-06-22 06:10:50 -10:00
Andy
2b9166b2f9
Don't recommend to install '@types/foo' if that already exists (#24815)
* Don't recommend to install '@types/foo' if that already exists

* Add different extra diagnostic text if the @types package exists

* Update API (#24966)
2018-06-21 10:19:14 -07:00
Anders Hejlsberg
4f99bc19c8 Merge branch 'master' into restTuples
# Conflicts:
#	tests/baselines/reference/APISample_Watch.errors.txt
#	tests/baselines/reference/APISample_WatchWithDefaults.errors.txt
#	tests/baselines/reference/APISample_WatchWithOwnWatchHost.errors.txt
#	tests/baselines/reference/APISample_compile.errors.txt
#	tests/baselines/reference/APISample_jsdoc.errors.txt
#	tests/baselines/reference/APISample_linter.errors.txt
#	tests/baselines/reference/APISample_parseConfig.errors.txt
#	tests/baselines/reference/APISample_transform.errors.txt
#	tests/baselines/reference/APISample_watcher.errors.txt
#	tests/baselines/reference/api/tsserverlibrary.d.ts
#	tests/baselines/reference/api/typescript.d.ts
2018-06-16 07:47:30 -07:00
Ryan Cavanaugh
73844ac565 Accept baseline 2018-06-15 11:10:54 -07:00