Commit Graph

2333 Commits

Author SHA1 Message Date
Wesley Wigham
7d93434f2c Fix crash on non-dts-require (#19980) 2017-11-13 16:41:29 -08:00
Wesley Wigham
3d602936e0 Handle binding elements while looking for invalid await and yield (#19972)
* Handle omitting a node in addCustomPrologue, account for binding elemnts in isInParameterInitializerBeforeContainingFunction

* Use append

* Fix lint
2017-11-13 16:40:08 -08:00
Wesley Wigham
b3d3b781ab Treat {} in T = {} as any in JS files (#19977) 2017-11-13 15:39:08 -08:00
uniqueiniquity
0fe0ff7943 Add test 2017-11-13 10:55:33 -08:00
Wesley Wigham
16efae2433 Consider the commonjs module indicator as a module indicator (#18490)
* Consider the commonjs module indicator as an indicator that something is effectively an external module

* Only use commonjs module indicator when targeting commonjs
2017-11-09 16:49:04 -08:00
Andy
90ae9ffe6e If there is an export default x; alias declaration, disallow other default exports (#19872) 2017-11-09 12:21:37 -08:00
Wesley Wigham
a1014b2b13 Mark all parameters as needed for metadata when one is decorated (#19849)
* Mark all properties as needed for metadata when one is decorated

* Add restarg test
2017-11-09 00:26:33 -08:00
Wesley Wigham
ceaeffa3ab Fix declaration emit for imported export alias specifiers (#19852)
* Badness

* Revert #3641, whose original bug has been fixed by other means

* Add another repro
2017-11-08 18:44:46 -08:00
Nathan Shively-Sanders
90f87ef180 Merge pull request #17765 from tycho01/6229-known-length-tuples
add `strictTuples` flag giving tuples known length
2017-11-08 15:38:39 -08:00
Adrian Leonhard
a1da5bd5af Changed error for setter when emitting declaration with private param type (#18593)
so that error message refers to prop name instead of param name.

Changed getter errors for similar case so they also refer to prop name.

Fixed bug where static getters wouldn't output their specific error.

Fixes #1976
2017-11-08 10:02:39 -08:00
Andy
ef6f9351b5 Fix undefined error for diagnostic for instantiating an abstract class (#19809)
* Fix undefined error for diagnostic for instantiating an abstract class

* Only use the name-less diagnostic
2017-11-08 09:40:53 -08:00
Wesley Wigham
d79c37cd19 Discriminate contextual types (#19733)
* Discriminate contextual types

* Invert conditional

* Update findMatchingDiscriminantType and baselines
2017-11-06 16:09:35 -08:00
Sean Barag
a46d2705ef Use documentation comments from inherited properties when @inheritDoc is present (#18804)
* Use documentation comments from inherited properties when @inheritDoc is present

The JSDoc `@ineheritDoc` [tag](http://usejsdoc.org/tags-inheritdoc.html)
"indicates that a symbol should inherit its documentation from its
parent class".  In the case of a TypeScript file, this also includes
implemented interfaces and parent interfaces.

With this change, a class method or property (or an interface property)
with the `@inheritDoc` tag in its JSDoc comment will automatically use
the comments from its nearest ancestor that has no `@inheritDoc` tag.
To prevent breaking backwards compatibility,
`Symbol.getDocumentationComment` now accepts an optional `TypeChecker`
instance to support this feature.

fixes #8912

* Use ts.getJSDocTags as per @andy-ms 's recommendation

* Convert @inheritDoc tests to verify.quickInfoAt

* Concatenate inherited and local docs when @inheritDoc is present

* Make typeChecker param explicitly `TypeChecker | undefined`

* Re-accept baseline after switch to explicit `| undefined`

* Update APISample_jsodc.ts to match new getDocumentationComment signature

* Re-accept baselines after rebasing
2017-11-06 13:18:21 -08:00
Wesley Wigham
0593ba27d8 Make getContextualTypeOfApparentType mapType over unions (#17668)
* Instantiate contextual types while in an inferrential context

* Limit scope of instantiation to only when likely needed

* Still get aparent type

* Expand test

* Fix nit

* Handle JSX and array

* Tests for the JSX and Array cases

* After much deliberation and inspection, much simpler fix

After much deliberation and inspection, much simpler fix

Undo

Redo
2017-11-06 12:52:33 -08:00
Wesley Wigham
4f48bf80fe Revised emit for computed property names, including with decorators (#19430)
* Revised emit for computed property names

* Fix downlevel name generation scopes

* Accept slightly more conservative baseline

* First feedback pass

* Reduce number of nonrequired variable declarations and assignments

* Remove side-effect-free identifier references

* skip partially emitted expressions

* Comments, move starsOnNewLine to emitNode

* Put expressions on newlines when inlined in class expressions for consistency

* Update new ref

* Fix typo in comment
2017-11-06 12:51:34 -08:00
Nathan Shively-Sanders
c2374c4ec3 Merge branch 'master' into 6229-known-length-tuples 2017-11-06 10:51:34 -08:00
Anders Hejlsberg
baafe5157e Add regression test 2017-11-06 09:25:51 -08:00
Andy
845c066923 Check for unused locals in commonjs modules (#19612) 2017-11-03 17:46:19 -07:00
Nathan Shively-Sanders
a980d61f86 Add a few tuple tests and update baselines 2017-11-03 09:56:39 -07:00
Mohamed Hegazy
1e89e78dd2 Fix incorrect relative module name detection (#19702) 2017-11-03 08:59:19 -07:00
Anders Hejlsberg
18b5ade05d Add regression test 2017-11-02 14:48:34 -07:00
Nathan Shively-Sanders
98e9a561af Merge pull request #19219 from Microsoft/abstract-property-access-error-in-own-constructor-only
Abstract property access error in own constructor only
2017-10-31 13:27:24 -07:00
uniqueiniquity
3ebb2e8a34 Merge branch 'master' into jsxFragment 2017-10-31 10:53:57 -07:00
Wesley Wigham
c2aa13dac5 Parenthesize export assignments if needed (#19590)
* parenthesize export assignments if needed

* Add default-specific parenthesization to handle lookahead

* New parenthesization logic for export default

* Handle commalist and comma cases
2017-10-30 18:23:32 -07:00
Andy
f0da3d7336 Fix declaration emit for typeof default export (#19471)
* Fix declaration emit for `typeof` default export

* Add comment
2017-10-30 11:40:32 -07:00
uniqueiniquity
a83ec4167e Added test for preventing fragment with jsxFactory 2017-10-25 10:18:18 -07:00
Andy
8b7d859fb3 Make it a noImplicitAny error to fail to provide type arguments to a superclass via @augments (#18778)
* Make it a noImplicitAny error to fail to provide type arguments to a superclass via @augments

* Don't recommend to add an @augments tag if it already exists

* Suggestions from code review

* Shorten error message
2017-10-20 09:41:19 -07:00
Wesley Wigham
8212c962cd Workaround for nonnull operator on indexed accesses (#19275)
* Quick and dirty workaround

* Add third case to show current behavior

* Rename variable, replace elaboration from comment with links
2017-10-18 17:39:05 -07:00
Andy
28509e1732 noUnusedLocals: Warn for recursive call to private method (#18920) 2017-10-17 11:57:47 -07:00
Nathan Shively-Sanders
e58aa10068 Test excess property checks of spreads of unions. 2017-10-17 09:56:28 -07:00
uniqueiniquity
269d37a2e6 Update tests 2017-10-17 09:38:22 -07:00
uniqueiniquity
abb3f58db2 Add support for JSX fragment syntax 2017-10-17 09:38:09 -07:00
Ron Buckton
06fd5e0bfe Merge pull request #19230 from Microsoft/fix18186
Do not reduce subtypes of awaited union type
2017-10-16 15:17:30 -07:00
Ron Buckton
eebb0447ab Fix generated name scope when emitting async functions 2017-10-16 14:47:43 -07:00
Ron Buckton
9563246993 Do not reduce subtypes of awaited union type 2017-10-16 14:26:16 -07:00
Wesley Wigham
aea7e9a7a8 Fix instantiated generic mixin declaration emit (#19144)
* Fix #18545, dont use declared type of class expression

* Accept API Baselines

* Add thus far unused flag from node builder

* Accept baseline update
2017-10-16 14:17:55 -07:00
Andy
2cb0403e2d Support 'package.json' not in package root (#19133)
* Support 'package.json' not in package root

* Test "foo/@bar"

* More tests, and don't use "types" from the root package.json if not loading the root module
2017-10-16 13:02:15 -07:00
Wesley Wigham
40222d1a77 Fix for-in emit under systemjs (#19223) 2017-10-16 12:57:23 -07:00
Nathan Shively-Sanders
49beac919c Abstract property access error only on this access 2017-10-16 09:43:49 -07:00
Nathan Shively-Sanders
fb45b49afc Test:abstract prop access in non-declaring ctor 2017-10-16 09:20:28 -07:00
Daniel Rosenwasser
144026cd3b Merge pull request #19174 from Microsoft/correctlyScopedtaggedTemplates-master
Fix uniqueness for tagged template variables
2017-10-13 16:54:47 -07:00
Daniel Rosenwasser
16f7f6f2e9 Added test case. 2017-10-13 15:40:31 -07:00
Wesley Wigham
de0e475c64 Recreate old decorator metadata behavior (#19089)
* Emulate pre 2.4 metadata behavior of eliding null and undefined from unions without strictNullChecks

* Accept baseline

* Update comment

* Update for second old baseline

* Respect strict
2017-10-12 15:05:04 -07:00
Wesley Wigham
9af21eb00e Transform nested dynamic imports (#18998)
* Fix nested dynamic imports when targeting es6

* Fixup nested dynamic imports when targeting downlevel

* Remove duplicated expressions in UMD emit

* Code review feedback, clone arg if need be

* More CR feedback, apply user quotemark styles

* Remove blank lines

* Use behavior of visitEachChild instead of enw codepath, add new test, use createLiteral to retain quotemarks

* Set lib flag for test
2017-10-12 12:53:12 -07:00
Nathan Shively-Sanders
54ad9a6c82 Merge pull request #19112 from Microsoft/fill-missing-type-arguments-during-error-reporting
Fill missing type arguments during error reporting
2017-10-12 11:02:25 -07:00
Anders Hejlsberg
728d2a92ce Merge pull request #19091 from Microsoft/fixAnonymousTypeInstantiation
Fix anonymous type instantiation
2017-10-12 00:54:14 +01:00
Anders Hejlsberg
6cf41ae882 Merge pull request #19107 from Microsoft/fixRecursiveCallbacks
Fix checking of recursive callback types
2017-10-12 00:28:16 +01:00
Anders Hejlsberg
19f70f6d3d Add additional test 2017-10-11 16:03:15 -07:00
Wesley Wigham
b949245336 Add ValueModule as a valid object literal type, as they are immutable (#19090)
* Add ValueModule as a valid object literal type, as they are immutable

* Rename method based on usage
2017-10-11 15:13:33 -07:00
Nathan Shively-Sanders
156e7e2069 Test:Incorrect number of type args during err reporting 2017-10-11 14:02:20 -07:00