Commit Graph

4709 Commits

Author SHA1 Message Date
Nathan Shively-Sanders
0ff8eeb308 Comment getTypeReferenceId and getRelationKey 2017-08-31 13:51:55 -07:00
Anders Hejlsberg
2510177593 Fix to use correct target type ID 2017-08-31 13:51:29 -07:00
Anders Hejlsberg
4925f2f05f Optimize relations for type references with unconstrained type arguments 2017-08-31 13:51:24 -07:00
Ron Buckton
187a21cbac Fix crash in name resolution with custom transforms and emitDecoratorMetadata 2017-08-25 15:14:54 -07:00
Wesley Wigham
a39ae1fab7 Fix crash when attempting to merge an import with a local declaration (#18032) (#18034)
* There should be no crash when attempting to merge an import with a local declaration

* Show symbol has actually merged within the module
2017-08-24 23:58:20 -07:00
Ron Buckton
9bb1915851 PR feedback 2017-08-24 17:01:28 -07:00
Ron Buckton
ec8f5cfe3f Follow symbol through commonjs require for inferred class type 2017-08-24 17:01:21 -07:00
Mohamed Hegazy
6da73b05f9 Port #17771 to release-2.5 (#18018)
* No contextual return type when type is circular

* Add regression test
2017-08-24 11:03:43 -07:00
Wesley Wigham
34e42097e4 Allow use before declaration for export= assignments (#17967) (#17972)
* Allow use before declaration for export= assignments (#17967)

* Add release-2.5 to covered branches
2017-08-23 10:03:46 -07:00
Andy
a5c9f40344 In services, show the aliasSymbol for a type even if it's not accessible in the current scope (#17810) 2017-08-15 14:59:26 -07:00
Ryan Cavanaugh
c110ecb870 Merge pull request #17625 from RyanCavanaugh/extract-method-2
Extract Method
2017-08-11 10:54:48 -07:00
Andy
b3f3f336ad Use hasModifier and hasModifiers helper functions (#17724) 2017-08-11 07:15:15 -07:00
Ryan Cavanaugh
c27ee81341 Merge branch 'master' into extract-method-2 2017-08-10 17:02:14 -07:00
Ryan Cavanaugh
1ad411e13e Various fixes 2017-08-10 13:13:18 -07:00
Andy
08fbcd8b80 Fix many no-object-literal-type-assertion lint errors (#17278)
* Fix many no-object-literal-type-assertion lint errors

* Simple fixes

* Use a union for FlowNode

* PR feedback and remove remaining `id()` uses

* Use a union for CodeBlock

* Discriminate CodeBlock by CodeBlockKind
2017-08-10 12:52:15 -07:00
Andy
fe3a05e89a A function should be context-sensitive if its return expression is (#17697)
* A function should be context-sensitive if its return expression is

* Remove outdated comment

* Fix typo
2017-08-10 07:08:24 -07:00
Andy
4c824505ad Treat NoSubstitutionTemplateLiteral same as a StringLiteral (#17704) 2017-08-10 06:53:48 -07:00
Andy
2c4361aadf Simplify assignTypeToParameterAndFixTypeParameters (#17706) 2017-08-10 06:51:50 -07:00
Nathan Shively-Sanders
8ae7c6c227 Fix type predicate index in error reporting
Previously type predicate error checking didn't take the `this`
parameter into account when checking for errors. This led to spurious
errors. Note that it's not feasible to change the initial value of
`parameterIndex` because several checks refer to the original
declaration, for example to make sure that a type predicate doesn't
refer to a rest parameter.
2017-08-09 15:43:47 -07:00
Andy
e1ba65ae64 Add simple version of chooseOverload for common case of single non-generic signature (#17589)
* Add simple version of `chooseOverload` for common case of single non-generic signature

* Use a single function
2017-08-09 14:41:38 -07:00
Andy
17a6f7b56a Remove unused internal utilities (#17380)
* Remove unused internal utilities

* Handle undefined input to `mapDefined`
2017-08-09 14:37:59 -07:00
Andy
f28f5fd041 Don't check function expression grammar if this is SkipContextSensitive (#17698) 2017-08-09 14:09:52 -07:00
Wesley Wigham
43e758e1a9 Create synthetic default exports for dynamic imports (#17492)
* Create synthetic default exports for dynamic imports

* Slightly better solution

* Actually accept baselines

* Slightly adjust synthetic type

* Cache synthetic type

* Inline variables, remove non-required calls

* Rename function
2017-08-08 17:01:18 -07:00
Nathan Shively-Sanders
847d7fe3c8 Merge pull request #17404 from Microsoft/use-type-param-constraints-for-computed-prop-types
Use type parameter constraints for computed property types
2017-08-08 16:29:28 -07:00
Ron Buckton
75c8ecb2f1 Merge pull request #17517 from tinganho/IgnoredCatchParameter
Ignored catch parameter
2017-08-08 16:15:18 -07:00
Nathan Shively-Sanders
fac93a304c Add parentheses:clarify evaluation order of &&/||
in isTypeAssignableToKind
2017-08-08 16:11:42 -07:00
Nathan Shively-Sanders
e47df360dc Use isTypeAny instead of checking flags directly 2017-08-08 14:51:06 -07:00
Andy
3deb39bba6 Remove unnecessary check that type is ObjectType (#17418) 2017-08-08 14:01:16 -07:00
Nathan Shively-Sanders
e494d73b29 Merge branch 'master' into use-type-param-constraints-for-computed-prop-types 2017-08-08 13:26:24 -07:00
Wesley Wigham
a46d6bde97 Add a seperate cache for the all attributes version of the jsx attributes type (#17620) 2017-08-08 13:07:27 -07:00
Nathan Shively-Sanders
a2c66c3262 Merge pull request #17660 from Microsoft/weak-type-errors-on-signature-only-types
Weak type errors on signature-only types
2017-08-08 12:40:50 -07:00
Nathan Shively-Sanders
7ff1d8e797 Add specific weak type error for callable types
"Did you mean to call it?"
2017-08-08 11:25:32 -07:00
Andy
94518e8533 Don't count self-reference when setting isReferenced (#17495)
* Don't count self-reference when setting `isReferenced`

* Improve comment
2017-08-08 11:18:20 -07:00
Nathan Shively-Sanders
781da2332d Merge branch 'master' into weak-type-errors-on-signature-only-types 2017-08-08 10:45:52 -07:00
Anders Hejlsberg
aa0fc0b885 Merge pull request #17633 from Microsoft/indexSignatureMappedType
Mapped type and string index signature relations
2017-08-07 14:17:29 -07:00
Anders Hejlsberg
3118e81297 Merge pull request #17634 from Microsoft/fixSignatureStackOverflow
Fix stack overflow related to contextual signature instantiations
2017-08-07 14:00:14 -07:00
Nathan Shively-Sanders
a282cbb07e Weak type errors for signature-only types too
Now source types that only have a call signature (like functions) or construct
signature will get a weak type error too. This is really good for
catching uncalled functions:

```ts
functionTakingWeakType(returnWeakType);
// OOPS. Forgot to call `returnWeakType()`. That's an error!
```
2017-08-07 10:56:18 -07:00
Anders Hejlsberg
313c93c861 Merge pull request #17521 from Microsoft/deferLookupTypeResolution
Defer indexed access type resolution
2017-08-07 08:25:06 -07:00
Anders Hejlsberg
d0a195a3c5 Propagate type comparer function in contextual signature instantiation 2017-08-05 12:32:56 -07:00
Anders Hejlsberg
44a6c6cc6f { [P in K]: T } is related to { [x: string]: U } if T is related to U 2017-08-05 10:09:44 -07:00
Ryan Cavanaugh
c7f665faa1 Extract Method (squash) 2017-08-04 16:10:33 -07:00
Nathan Shively-Sanders
8f7a582fc5 Merge branch 'master' into inferFromRelatedTypesOnly 2017-08-04 15:21:17 -07:00
Anders Hejlsberg
13750d2d65 Only infer from members of object types if the types are possibly related 2017-08-03 08:07:07 -07:00
Daniel Rosenwasser
1552761982 Merge pull request #17425 from ikatyang/fix-17392
Retain literal type for prefix plus on number literal
2017-08-02 18:41:21 -07:00
Wesley Wigham
c06a30ae68 JSDoc Instantiation Fixes (#17553)
* Fix #17383 - issue an error when jsdoc attempts to instantiate a builtin as a generic

* Fix comment

* Fix #17377 - only get type parameters from reference target if the type is a reference

* Fix #17525 - Add SyntaxKind.AsteriskToken to isStartOfType
2017-08-02 13:55:14 -07:00
Anders Hejlsberg
467245780d Merge pull request #17455 from Microsoft/mappedTypeFixes
Mapped and indexed access type fixes
2017-08-02 13:36:37 -07:00
Anders Hejlsberg
caea4f3a50 Properly handle constraints for types like (T & { [x: string]: D })[K] 2017-08-02 11:54:29 -07:00
Nathan Shively-Sanders
a0333b55e5 Merge branch 'master' into use-type-param-constraints-for-computed-prop-types 2017-08-02 10:40:16 -07:00
Nathan Shively-Sanders
011f712d98 isTypeAssignableToKind:Chain isTypeAssignableTo calls
Instead of building up a list and creating a union type.
2017-08-02 09:58:01 -07:00
Nathan Shively-Sanders
d07eca72a3 Improve name:isTypeAssignableToKind+cleanup TODOs 2017-08-02 09:38:44 -07:00