Commit graph

1832 commits

Author SHA1 Message Date
Ron Buckton
f67afa098f Unpatch vfs resolver and default lib rename 2018-05-03 14:18:50 -07:00
Ron Buckton
d62a11ffc0 Merge branch 'master' into vfs 2018-05-01 18:58:31 -07:00
Anders Hejlsberg
4c933aef9a Check that test cases produce expected types 2018-05-01 13:05:49 -07:00
Anders Hejlsberg
59355cbfdb Add regression tests 2018-05-01 12:44:46 -07:00
Nathan Shively-Sanders
5ea4d3b2bb
No error for require, module.exports or exports in Javascript (#23743)
* No error for require

Still errors for module and exports, and require's type is now
incorreclty 'any'; I broke module resolution somehow. Needs
investigation.

* module/exports symbols+update isCommonJsRequire

Everything passes the tests but the code can be improved

* Update baselines

* Cleanup

* Update baselines of new tests

* Get rid of exports symbol

It wasn't doing anything anyway.
2018-04-30 15:47:59 -07:00
Nathan Shively-Sanders
7cda045d52
Always export typedefs (#23723)
* Always export typedefs

This actually just required deleting a check in declareModuleMembers
and checking for external AND commonjs modules in a couple of places.

However, while experimenting with this feature, I discovered that even
previously-exported typedefs would only be exported if they came after a
commonjs export node. So I added a commonjs check to the pass in the
parser. It will not catch nested module.exports, but it will catch
top-level assignments.

The new test tests both changes.

* Post-bind typedef instead of pre-checking for commonjs

* Duplicate identifier errors

* Fix class type reference resolution+update baselines

* Move to a type-based check for duplicate identifiers
2018-04-30 14:55:26 -07:00
Anders Hejlsberg
936444ad7b Add tests 2018-04-29 07:55:23 -07:00
Anders Hejlsberg
25d5952096
Merge pull request #23751 from Microsoft/reduceIntersectionTypes
Remove redundant primitive types from intersections
2018-04-28 11:42:56 -07:00
Daniel Rosenwasser
443c1c7965
Merge pull request #23327 from Microsoft/importDotMeta
Support 'import.meta'
2018-04-27 20:52:28 -07:00
Daniel Rosenwasser
12a3e39dca Specify ESNext module in test. 2018-04-27 18:17:49 -07:00
Anders Hejlsberg
38d1f7f0d2 Add tests 2018-04-27 16:50:09 -07:00
Anders Hejlsberg
6c28da328e
Merge pull request #23672 from Microsoft/intersectionWithUnionConstraint
Type relationships for intersections with union constraints
2018-04-27 15:53:00 -07:00
Anders Hejlsberg
5ecd03e8c0
Merge pull request #23660 from Microsoft/fixIndexTypeTargetConstraint
Fix constraint of 'keyof T[K]' in target position
2018-04-27 15:52:21 -07:00
Nathan Shively-Sanders
3631af6486
Remove readonly from object rest properties (#23746)
* Remove readonly from object rest properties

Works the same as removing it from object spread properties

* Fix bug number in test
2018-04-27 14:54:59 -07:00
Ron Buckton
4863d55d01 Merge branch 'master' into vfs 2018-04-27 14:03:42 -07:00
Nathan Shively-Sanders
1595f7fe83
Add prettier user test and fix associated crash (#23715)
* Add prettier and fix crash bug

Name resolution would crash when resolving a type name inside a
typedef's property tag.

* Update tsconfig and thefore prettier baseline
2018-04-26 14:03:18 -07:00
Nathan Shively-Sanders
1541599ea0
Check base type for special property declarations (#23671)
If the base type has a property by that name, add it to the list
constructor types to make it as authoritative as special assignments
found in the constructor.
2018-04-26 08:14:22 -07:00
Daniel Rosenwasser
9672116d8c Merge remote-tracking branch 'origin/master' into importDotMeta 2018-04-25 22:21:56 -07:00
Nathan Shively-Sanders
b2bfccfce4
Prototype-property assignment:fix name resolution crash (#23680) 2018-04-25 13:59:40 -07:00
Anders Hejlsberg
8442a45bb6 Add additional tests 2018-04-25 11:03:25 -07:00
Anders Hejlsberg
50c7ff79d0 Add tests 2018-04-24 15:57:17 -07:00
Anders Hejlsberg
ad4f83a281 Merge branch 'master' into fixIndexTypeTargetConstraint
# Conflicts:
#	tests/baselines/reference/keyofAndIndexedAccess.js
#	tests/baselines/reference/keyofAndIndexedAccess.symbols
#	tests/baselines/reference/keyofAndIndexedAccess.types
#	tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts
2018-04-24 11:08:08 -07:00
Anders Hejlsberg
57ef618120 Add regression test 2018-04-24 10:02:47 -07:00
Ron Buckton
bb26ab5556 Merge branch 'master' into vfs 2018-04-23 22:48:48 -07:00
Anders Hejlsberg
7befd35009 Add tests 2018-04-23 21:09:49 -07:00
Nathan Shively-Sanders
905f9a02ad
module.exports = Entity is an alias, just like export = Entity (#23570)
* Make `module.export =` an alias like `export=` is

This breaks a couple of tests for previous workarounds. Fix in upcoming
commits.

* Basically fixes all the breaks, but needs cleanup

* More notes to myself

* Clean up TODOs

* Call mergeSymbolTable and delete export= afterward

instead of basically copying the code myself.

* More cleanup

* Remove unnecessary check in import type checking

* Revert to DIY code.

It is more correct and will go away in a few days.

* Exported class expressions can be used as type

In both JS and TS

* Do not require named class expressions
2018-04-23 15:24:31 -07:00
Anders Hejlsberg
0179d97403
Merge pull request #23592 from Microsoft/improveIndexTypes
Support number and symbol named properties with keyof and mapped types
2018-04-23 13:22:56 -07:00
Mohamed Hegazy
7f34340dcf
Merge pull request #21476 from Kingwl/concat-string-in-enum-member
allow string concat in enum member declaration
2018-04-21 12:42:10 -07:00
kingwl
1e1b72892c accept baseline 2018-04-21 12:06:29 +08:00
Nathan Shively-Sanders
e65681a2b7
Fix assert in getjsdochost (#23575)
* Fix assert in getJSDocHost

* Update public API to add wider type

* Remove now-unnecessary type assertion
2018-04-20 10:41:58 -07:00
Klaus Meinhardt
8e565fb4a6 avoid generated helpers in baseline 2018-04-20 16:39:37 +02:00
Klaus Meinhardt
4827728b16 binder: don't inline generator function's control flow
Fixes: #23565
2018-04-20 16:26:53 +02:00
Ron Buckton
370107ed7b Merge branch 'master' into vfs 2018-04-19 16:55:35 -07:00
Nathan Shively-Sanders
8d969a23cb
In JS, class supports @template tag for declaring type parameters (#23511)
* Support @template as a class type parameter

Still need to do the following:
1. Correctly get jsdoc host in predicate.
2. Make this work for constructor functions too.
3. Scan rest of codebase for other usages of the type parameters
property that should be calls to getEffectiveTypeParameterDeclarations.
4. Rename tp to something more readable, like typar or ts'.

* Use jsdoc host declaration to find container

* Longer names for type parameters

* Fix renaming operation

* Update fourslash test

* Support @template for JS constructors

* Look for both outer and tag type parameters

* Improve naming to improve code clarity
2018-04-19 15:58:43 -07:00
Daniel Rosenwasser
84b12910e8
Merge pull request #23430 from Microsoft/taggedTemplateTypeArguments
Allow type arguments in generic tagged templates
2018-04-19 15:50:19 -07:00
Daniel Rosenwasser
7f96fec9d9 Added test in case 'super' is ever possibly parsed as a tagged template string. 2018-04-19 15:16:25 -07:00
Daniel Rosenwasser
8e27f4693c Added test for ASI concerns. 2018-04-19 10:34:31 -07:00
王文璐
2455405b02 allow string concat in enum member declaration 2018-04-19 21:48:51 +08:00
Mohamed Hegazy
52192006cf
Merge pull request #20671 from Kingwl/fix-import-not-existed-module
error if import empty object form module not existed
2018-04-17 17:29:07 -07:00
Ron Buckton
1cbe930e06 Merge branch 'master' into vfs 2018-04-17 14:39:20 -07:00
Anders Hejlsberg
16cd5580a6 Merge branch 'master' into improveIndexTypes
# Conflicts:
#	src/compiler/checker.ts
#	src/server/utilities.ts
2018-04-16 16:18:29 -07:00
Daniel Rosenwasser
6107e05e8c Added test for tagged templates in new expressions. 2018-04-15 15:57:38 -07:00
Daniel Rosenwasser
60b6d3fbce Fixed up test. Thanks arrow functions... 2018-04-13 23:45:15 -07:00
Daniel Rosenwasser
b409888cbc Added tests. 2018-04-13 23:01:24 -07:00
Nathan Shively-Sanders
9ceb113ec5
Allow exports assignments (#23319)
1. Allow assignment to `exports`.
2. The type of the rhs is not checked against the type of `exports`
since they are aliased declarations.

To support more complex patterns like `exports = c.name = c`, we may
have to treat `c.name` as a declaration. That will be more complicated
than this PR.
2018-04-11 06:49:58 -07:00
Anders Hejlsberg
0a37cd3736 Update test 2018-04-10 17:35:27 -10:00
Daniel Rosenwasser
4f497e6c0c Added tests around ES5, assigning to 'import.meta' and properties, global augmentations. 2018-04-10 16:28:50 -07:00
Nathan Shively-Sanders
22919d57fe
JSDoc:positional matching of destructured params (#23307)
* JSDoc:positional matching of destructured params

1. When looking up tags for a parameter whose name is a binding pattern, use
the index of the parameter to get the type.
2. When reporting errors for `@param` tags with no matching parameter
name, do not report the error for tags whose index in the `@param` tag list
matches the index of a parameter whose name is a binding pattern.

* Change to an assert

* Improve comment text
2018-04-10 12:48:35 -07:00
Daniel Rosenwasser
8923eec80a Added tests for 'import.meta'. 2018-04-09 15:26:30 -07:00
Anders Hejlsberg
0379666bbf Update tests 2018-04-09 08:51:55 -10:00