Commit Graph

5714 Commits

Author SHA1 Message Date
Andy
5725428f2d fixUnusedIdentifier: Handle destructure with all bindings unused (#23805)
* fixUnusedIdentifier: Handle destructure with all bindings unused

* Add parameters test

* Add test for 'for' loop
2018-05-08 13:33:55 -07:00
Anders Hejlsberg
40e0ab72d2 Merge pull request #23966 from Microsoft/fixIndexedAccessAnyConstraint
Fix indexed access with 'any' constraint
2018-05-08 12:21:00 -07:00
Anders Hejlsberg
ce6fd5eeaa Exception for 'any' constraint only applies to type parameters 2018-05-08 09:42:03 -07:00
Ryan Cavanaugh
ffa0ccba2a Project References Core support 2018-05-07 15:12:50 -07:00
Wesley Wigham
618da24d6a Look at simplified types when checking distributive conditional constraints (#23884) 2018-05-04 14:35:39 -07:00
Sheetal Nandi
4e6586deb8 PR feedback 2018-05-04 10:45:46 -07:00
Sheetal Nandi
15f9ea3d14 Merge branch 'master' into requireJson 2018-05-03 15:35:54 -07:00
Wesley Wigham
eb80e9a51c node builder should strive to preserve mapped type keyofness (#23815) 2018-05-03 12:38:31 -07:00
Wesley Wigham
19a985eb24 Dont consider global augmentation top-level members as having the export modifier (#23846)
* Dont consider global argumentation top-level members as having the export modifier

* Remove unneeded test parts from repro
2018-05-03 11:21:11 -07:00
Wesley Wigham
41182c2f0b Stop using circularity-unchecked-caching (#23808)
* Stop using circularity-unchecked-caching

* Add comment
2018-05-03 10:44:17 -07:00
Wesley Wigham
c663645c91 Inform getDeclarationSpaces about how an imported exportAssignment may merge (#23816) 2018-05-01 17:24:30 -07:00
Anders Hejlsberg
1de8c65678 Unconstrained type parameter not assignable to 'object' 2018-05-01 12:38:29 -07:00
Sheetal Nandi
97df079feb PR feedback 2018-04-30 17:05:22 -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
Wesley Wigham
0c244d86b3 Add used-before-declaration errors for class refs inside computed names (#23784) 2018-04-30 12:55:30 -07:00
Sheetal Nandi
579748bc2b Merge branch 'master' into requireJson 2018-04-30 11:44:09 -07:00
Anders Hejlsberg
672d2144fa Check for null type instead of null keyword 2018-04-30 10:43:43 -07:00
Anders Hejlsberg
fc2f16ca3c Treat unconstrained T[K] the same as unconstrained T 2018-04-29 07:46:57 -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
Anders Hejlsberg
5a7eb1cbc8 Fix typo 2018-04-28 08:24:41 -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
161535bc84 Check for both 'module' and 'target'. 2018-04-27 17:51:18 -07:00
Wesley Wigham
8c5ad2429a Relax switch-case narrowing restrictions (#23522)
* Allow switch case narrowing even when individual clauses are nonunit

* And remove unit type restriction

* Rename
2018-04-27 16:30:43 -07:00
Wesley Wigham
6d3b6e21da Add implicit any errors for destructuring computed names which aren't late bound and have no corresponding index (#23489)
* Add implicit any errors for destructuring computed names which arent late bound and have no corresponding index

* Add string fallback for number

* Expand test case, make functionality mimic other (buggy) areas

* Add symbol name errors to bring in line with new indexing rules
2018-04-27 15:55:32 -07:00
Anders Hejlsberg
cfe7284876 Merge branch 'master' into reduceIntersectionTypes 2018-04-27 15:54:17 -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
Wesley Wigham
d5ef1174bd Copy consistient valueDeclarations on union/intersection symbols (#23190) 2018-04-27 13:12:35 -07:00
Anders Hejlsberg
d25a6ec9ad Remove redundant primitive types from intersections with literal types 2018-04-27 10:40:16 -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
Wesley Wigham
4a6888a850 There exist type parameters with symbols but without TypeParameterDeclaration nodes (#23690)
* There exist type parameters with symbols but without TypeParameterDeclaration nodes

* Add test
2018-04-25 15:53:06 -07:00
Nathan Shively-Sanders
b2bfccfce4 Prototype-property assignment:fix name resolution crash (#23680) 2018-04-25 13:59:40 -07:00
Wesley Wigham
ec05f29632 Make signature help node building cancellable (#23543)
* Make token building cancellable

* Scope cancellation token, make find all refs and quickinfo cancellable

* Make completion entry details cancellable

* Actually accept public API update

* Add test verifying cancellations within checker for select language service operations

* Document runWithCancellationToken a bit more

* Add post-cancellation verification to test
2018-04-25 11:44:13 -07:00
Anders Hejlsberg
3707f7dfbe Handle more situations involving combined constraints of intersections 2018-04-25 10:58:08 -07:00
Anders Hejlsberg
d90d6b9277 Remove more intersections with empty value domains from union types 2018-04-24 15:55:15 -07:00
Anders Hejlsberg
ef8d5094b4 Properly check relationships for intersections with union constraints 2018-04-24 14:57:27 -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
5d67f8ef68 Merge pull request #23645 from Microsoft/distributeKeyofUnion2
Distribute 'keyof' union types (take 2)
2018-04-24 10:09:45 -07:00
Anders Hejlsberg
e71afc32ad Reinstate type simplification for 'keyof T[K]' as target in relation 2018-04-24 10:02:34 -07:00
Andy
969aa45ea5 Improve error message for unused type (#23633) 2018-04-24 08:54:42 -07:00
Anders Hejlsberg
09590bc041 Transform 'keyof (A | B)' to 'keyof A & keyof B' 2018-04-23 20:57:11 -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
Wesley Wigham
eb112ab492 Deduplicate declarations in combined type/value symbols (#23593) 2018-04-21 12:50:05 -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
Anders Hejlsberg
652e4932f6 Address CR feedback 2018-04-21 09:32:46 -07:00
Andy
699ea246ff Skip arrow functions in checkAndReportErrorForMissingPrefix (#23584) 2018-04-20 15:02:18 -07:00