2742 Commits

Author SHA1 Message Date
Wesley Wigham
fefc47fae3
Flag JS Literals and ignore assignments/accesses to invalid props, instead of adding an index (#25996)
* Remove index signatures from js literals, use an object flag to indicate errors should be ignored instead

* Add focused test on the keyof problem

* Fix fourslash test

* Reenable errors with noImplicitAny flag

* Also disable excess property checks outside of noImplicitAny mode for js literals

* Edit and move comments
2018-08-02 13:40:44 -07:00
Wesley Wigham
2edc47bc67
Fix decorated accessor emit (#26016) 2018-07-31 13:53:28 -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
Wesley Wigham
d590d5bd0c
Remove extraneous const, fixing #25714 (#25982) 2018-07-26 14:43:00 -07:00
Wesley Wigham
d17efe69d1
Fix #25954 - Always retain export modifier if default modifier is present (#25974)
* Fix #25954 - Always retain export modifier if default modifier is present

* Also fix an issue with scope markers in ambient modules not affecting the modifiers required
2018-07-26 12:39:03 -07:00
Anders Hejlsberg
7b4d13c95c
Merge pull request #25859 from Microsoft/optimizePrimitiveIntersections
Optimize creation of intersections of union types
2018-07-25 10:28:43 -07:00
Wesley Wigham
59854bbd55
Inspect all possible module paths when looking for the best one to create a specifier with (#25850)
* Inspect all possible specifier paths when looking for the best one

* Add missing secondary option from test
2018-07-24 13:56:21 -07:00
Anders Hejlsberg
303e08fc4f Add regression test 2018-07-21 12:31:24 -07:00
Anders Hejlsberg
b48910413a Add regression test 2018-07-19 18:29:30 -07:00
Klaus Meinhardt
99d123a72d add correct test 2018-07-20 00:30:11 +02:00
Daniel Rosenwasser
37277e86e6
Merge pull request #25752 from Microsoft/objectsAgainstArrays
Avoid elaborating object literals against array-likes
2018-07-18 15:29:47 -07:00
Andy
751f20e8bc
Don't bother trying to get the name of a default export (#25773)
* Don't bother trying to get the name of a default export

* Fix lint
2018-07-18 11:43:13 -07:00
Daniel Rosenwasser
bda32aeee2 Added test. 2018-07-17 21:52:24 -07:00
Matt McCutchen
bd84179d82 Check for optional type parameters before issuing a "wrong number of
type arguments" error on a function call.

Fixes #25683.
2018-07-17 13:25:46 -04:00
Daniel Rosenwasser
93ab352189
Merge pull request #25565 from Microsoft/popFirst
Make 'pop' the first method that uses 'T' in 'Array'
2018-07-16 11:41:44 -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
Klaus Meinhardt
2a960011d7 Merge branch 'master' of github.com:Microsoft/TypeScript into multiple-prologue-directives 2018-07-11 18:47:23 +02:00
Daniel Rosenwasser
94ad71ecc3 Added test. 2018-07-10 19:34:19 -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
Klaus Meinhardt
f9eb976319 handle multiple prologue directives
Fixes: #24689
2018-07-10 22:42:21 +02:00
Andy
1fc1495863
Increase span of unreachable code error (#25388)
* Increase span of unreachable code error

* Add a new diagnostic for each range of unreachable statements

* Update baselines
2018-07-10 11:45:16 -07:00
Nathan Shively-Sanders
60c0dfeb25
Fix crash in JS when checking destructuring shorthand assignment (#25529) 2018-07-10 08:32:56 -07:00
Wesley Wigham
3d64b9d7ac
Handle intersection types when looking up base types for visibility (#25418)
* Handle intersection types when looking up base types for visibility

* Extract protected constructor check to function and recur on intersections

* Remove unneeded cast
2018-07-09 16:58:55 -07:00
Matt McCutchen
d5fd17bf0b Fix crash in elaborateElementwise when the target property is known but
it doesn't have a declaration (e.g., in a mapped type).

Fixes #25498.
2018-07-07 16:27:23 -04:00
Wesley Wigham
403df45678
Rework entity name decorator metadata fallback emit to not throw at runtime (#25421)
* Rework entity name decorator metadata fallback emit to not throw at runtime

* Remove trailing whitespace
2018-07-06 15:18:03 -07:00
Wesley Wigham
547856a11d
Strip literal freshness from type queries (#25471)
* Strip literal freshness from type queries

* Rename to fix typo
2018-07-06 13:07:29 -07:00
Wesley Wigham
7ad72d2440
Rework symbol visibility checking to allow for multiple potential containers (#24971)
* Rework symbol visibility checking to allow for multiple potential containers

* Express a preference for the local symbol if accessible from the enclosing declaration
2018-07-05 16:00:07 -07:00
Wesley Wigham
b8b34a38ec
Actually cache intermediate results in getBaseConstraint (#25417)
* Have getBaseConstraint push resolutions for the types it actually recurs on

* Cache base constraints correctly
2018-07-05 15:54:43 -07:00
Nathan Shively-Sanders
065e695a28
No merge for redirected source files in initializeTypeChecker (#25463)
Previously, redirected source files merged the same way as other source
files, effectively causing the target of the redirection to be merged
twice. mergeSymbol now has an assert (`source===target`) that catches
this condition, so this change makes sure to skip redirected source
files.

This change doesn't apply to the preceding binding loop, since the
binder handles already-bound source files correctly.
2018-07-05 13:49:34 -07:00
Mohamed Hegazy
2059c36afa
Merge pull request #25457 from Microsoft/resolveJsonModuleInterop
Do not report esModuleInterop needed error for json imports
2018-07-05 12:16:28 -07:00
Mohamed Hegazy
8911c19f4f
Merge pull request #25313 from github-john-doe/typo
Typo
2018-07-05 11:43:12 -07:00
Sheetal Nandi
cb622b413b Do not report esModuleInterop needed error for json imports
Fixes #25400
2018-07-05 10:39:39 -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
Mohamed Hegazy
17b10e8293
Merge pull request #25397 from a-tarasyuk/bug/25356-instance-property-is-not-a-block-scoped-variable
25356 - Instance property is not a block scoped variable
2018-07-03 14:11:28 -07:00
Andy
76a4694bd4
parser: Fix testing for missing list (#25411)
* parser: Fix testing for missing list

* Fix return type
2018-07-03 12:37:20 -07:00
Wesley Wigham
cb4cb7a75f
Check if module reference requires type reference before path reference (#25385) 2018-07-03 11:41:07 -07:00
Anders Hejlsberg
e8d64a9c7c
Merge pull request #25336 from Microsoft/fixResolveTypeMembers
Fix runaway recursion in object type member resolution
2018-07-03 07:53:02 -10:00
Alexander T
689793209f Update tests baseline. Change tests 2018-07-03 14:41:09 +03:00
Wesley Wigham
65655f2c6b
Change import type determination to not use a RE on the symbol name (#25381) 2018-07-02 17:43:39 -07:00
Mohamed Hegazy
4dd1f9fc7c Consolidate overloads in constructors for Map, Set, WeakMap, and WeakSet
Fixes https://github.com/Microsoft/TypeScript/issues/23551
Fixes https://github.com/Microsoft/TypeScript/issues/25362
2018-07-02 11:58:48 -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
Anders Hejlsberg
92f5f1dd9d Add regression test 2018-06-29 17:16:23 -10:00
Wesley Wigham
30db30055f
Fix module specifier case handling for declaration emit (#25110) 2018-06-29 11:02:43 -07:00
Daniel Rosenwasser
d46b54b639 Actually make the test file use '--strict'. 2018-06-28 22:36:59 -07:00
Daniel Rosenwasser
f23c180a38
Merge pull request #25287 from Microsoft/skipToNonNullTargets
Skip to non null targets in error messages
2018-06-28 22:26:36 -07:00
John Doe
a0c186a781 anohter -> another 2018-06-28 18:58:29 -07:00
Daniel Rosenwasser
12a201c29e Added test case. 2018-06-28 15:30:10 -07:00
Martin Probst
55c3ec3e94 Fix decorator design:types emit for type variables.
Previously, TypeScript would resolve the reified types for the
`design:types` decorator emit in the regular `currentScope`. That scope
does not include class declaration bodies.

However when reifying types, class declarations do introduce a new scope
for any `TypeVariable`s declared on them. Because TS resolved the
EntityName for such types against the parent scope (e.g. the source
file), not the class scope, TypeScript would either fail to resolve the type (giving `TypeReferenceSerializationKind.Unknown`), or
incorrectly resolve to a different, accidentally matching symbol in the outer scope (giving `TypeWithConstructSignatureAndValue`).

This would result in an emit referencing an undeclared symbol, or
mis-referencing the wrong symbol.

    __metadata("design:type", typeof (_a = typeof TypeVariable !== "undefined" && TypeVariable) === "function" && _a || Object)
    __metadata("design:type", TypeVariable)

This change special cases `currentScope` for
`serializeTypeReferenceNode` to use a class scope, if present. This
changes the emit for a `TypeVariable` back to `Object`:

    __metadata("design:type", Object)
2018-06-25 17:24:05 +02:00
Daniel Rosenwasser
72068e22af
Merge pull request #25115 from Microsoft/matchingTypeRefs
Improved errors using type reference targets
2018-06-21 13:46:21 -07:00