Commit Graph

2371 Commits

Author SHA1 Message Date
Anders Hejlsberg
8c4c529d8e Merge branch 'master' into strictPropertyInitialization 2017-11-17 14:30:23 -08:00
Nathan Shively-Sanders
c698a2b8e5 Merge pull request #19227 from Microsoft/infer-object-type-from-string-literal-to-keyof-T
Infer object type from string literal to keyof T
2017-11-16 15:07:12 -08:00
Charles Pierce
1da35d9dca Treat exhaustive switch as last statement in function #18882 (#20063) 2017-11-16 12:17:26 -08:00
Anders Hejlsberg
3a7a99f7c5 Accept new baselines 2017-11-16 11:08:03 -08:00
Anders Hejlsberg
3357aae2d8 Update tests 2017-11-16 10:58:12 -08:00
Ron Buckton
a21a129abb Merge branch 'master' into dynamicNames 2017-11-15 15:24:05 -08:00
Andy
4b96edf72f Treat ... in jsdoc type as creating a synthetic rest parameter -- not as an array type (#19483)
* Treat `...` in jsdoc type as creating a synthetic rest parameter -- not as an array type

* Change type parsing so `...T[]` parses as `...(T[])` and not `(...T)[]`

* Replace the last parameter with ...args, and make access to it potentially undefined

* Code review
2017-11-15 13:04:08 -08:00
Wesley Wigham
9c51a8534e Synchronize getEntityNameForDecoratorMetadata and serializeUnionOrIntersectionType (#19879) 2017-11-14 14:20:18 -08:00
meyer
36ce7eac5a Update JSX intrinsic element test to match babel’s (#19946)
* Update JSX intrinsic element test to match babel’s

* Update baseline

* Move regex out of isIntrinsicJsxName

* Switch to non-regex intrinsic name test
2017-11-14 09:40:32 -08:00
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
Ron Buckton
804c7d3690 Merge branch 'master' into dynamicNames 2017-11-13 13:24:20 -08:00
uniqueiniquity
0fe0ff7943 Add test 2017-11-13 10:55:33 -08:00
Nathan Shively-Sanders
ef07efe70a Merge branch 'master' into infer-object-type-from-string-literal-to-keyof-T 2017-11-13 08:46:49 -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
Ron Buckton
ee36e6a2ff Merge branch 'master' into dynamicNames 2017-11-06 17:54:48 -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
Ron Buckton
33e09f9a9d Merge branch 'master' into dynamicNames 2017-11-06 12:05:25 -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
Ron Buckton
208dfa6b01 Merge branch 'master' into dynamicNames 2017-11-03 22:10:28 -07: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
Ron Buckton
26ca98c820 Merge branch 'master' into dynamicNames 2017-10-30 18:02:53 -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
Ron Buckton
170e6ec130 Ensure correct errors when emitting declarations 2017-10-26 15:50:07 -07:00
uniqueiniquity
a83ec4167e Added test for preventing fragment with jsxFactory 2017-10-25 10:18:18 -07:00
Ron Buckton
51929acb89 Merge branch 'master' into dynamicNames 2017-10-21 00:36:52 -07:00
Ron Buckton
3341e07e67 Refactor widening 2017-10-20 22:52:20 -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