Commit Graph

7761 Commits

Author SHA1 Message Date
Sheetal Nandi
9c60d5a4d3 Dont look for properties of Object and Function type when looking to resolve named import from module with export= (#37964)
* Add tests

* Dont look at object or function type when looking for members of `export=` type to be resolved by named imports
Fixes #37165

* Create separate cache when skipping function and object property augmentation

* Lookup in both cache if not skipObjectFunctionPropertyAugment
2020-11-03 12:22:30 -08:00
Thomas Williamson
8ed251d0c7 Support xml namespace prefix for JSX elements and attributes (#37421)
* Support xml namespace prefix for JSX elements and attributes

Just as with the `-` character, `:` is now also treated specially in JSX
element and attribute names, but is only allowed a single time, and not
at the beginning or end of the name, as is specified in the JSX spec.
All tests in jsxInvalidEsprimaTestSuite still fail, but for slightly
different reasons now. Two lines in jsxEsprimaFbTestSuite were
uncommented as they included elements with namespaces, and they now pass
without error.

* Add case for colons at ends of identifier

* Add case for jsx namepsace intrinsics

* Add cases with upcase idents for jsx namespaces

* Add case for jsx namespaces with react option

* Always consider jsx names with colon to be intrinsics

* Adjust comment about chars valid in jsx names but not js idents

* Fix minor typo in namespace prefix test case variable name

* Remove misleading comments on isUnhyphenatedJsxName
2020-11-02 15:34:36 -08:00
Oleksandr T
3f92a6498f fix(40257): fix type parameters range (#40265) 2020-11-02 15:20:13 -08:00
Wenlu Wang
ce8d702586 Add support for pedantic property access (#40171)
* Add support for pedantic property access

* accept baseline

* Update diag message

* Avoid pedantic

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-11-02 15:19:00 -08:00
okmttdhr
7db5f68144 Add index signature for anonymous object literal type (#37903)
* Use ts.map for stylistic consistency

* Show error only if noImplicitAny is set

* Accept baseline for noImplicitAnyIndexing

* Fix lint error

* Add test cases for indexedAccessWithFreshObjectLiteral
2020-11-02 14:35:56 -08:00
Oleksandr T
f646ec87fc fix(40901): skip checking custom arguments name in a constructor (#40912) 2020-11-02 14:35:07 -08:00
Wesley Wigham
479105090d Merge pull request #41330 from weswigham/jsx-import-source-as-auto-import
Auto-include types for the jsx import source in the new jsx transforms
2020-10-30 16:51:04 -07:00
Wesley Wigham
e044b56d7f Merge pull request #40985 from weswigham/static-decl-ref
Adjust typeof import name lookup to better match type query lookup
2020-10-30 11:13:23 -07:00
Ron Buckton
f944afd053 Fix double alias of complex export/import/default/namespace combination 2020-10-29 18:42:36 -07:00
Wesley Wigham
6714998e01 Auto-include types for the jsx import source in the new jsx transforms 2020-10-29 14:17:24 -07:00
Wesley Wigham
60b8bbcabe Update style 2020-10-29 13:03:25 -07:00
Wesley Wigham
d722392d81 Fix crashes when the global JSX namespace is an alias 2020-10-28 14:31:40 -07:00
Wesley Wigham
ca8a15d37b Merge pull request #41287 from weswigham/bind-exports-assigned-object-as-alias
Bind `module.export = {Thing}` with alias symbols
2020-10-28 13:14:20 -07:00
Anders Hejlsberg
bd27bd8d47 Don't relate unmatched parameter positions in signatures (#41308)
* Don't relate unmatched parameter positions in signatures

* Add regression test

* Accept new baselines
2020-10-28 11:55:32 -07:00
Sheetal Nandi
e17d95dada When creating synthetic default symbol set parent as module symbol (#41282)
Fixes #40684
2020-10-28 11:24:40 -07:00
Wesley Wigham
6acce0ca6f Merge pull request #41075 from uhyo/fix-36958
allow type narrowing with NonNullExpression
2020-10-27 20:10:27 -07:00
Oleksandr T
af38ab90e2 feat(41249): allow import.meta with module: es2020 (#41274) 2020-10-27 17:26:15 -07:00
Anders Hejlsberg
40b81224f9 Remove string literals from unions with matching template literals (#41276)
* Remove string literals from unions with matching template literals

* Add tests

* Accept new baselines
2020-10-27 16:21:07 -07:00
Wesley Wigham
d1bc6b1ba6 Bind module.export = {Thing} with alias symbols 2020-10-27 15:43:00 -07:00
Wesley Wigham
c923023494 Merge pull request #41191 from weswigham/control-flow-comma-exprs
Track control flow for comma expressions in call expressions
2020-10-27 12:37:02 -07:00
Wesley Wigham
aaa8b74229 Merge pull request #41257 from weswigham/jsdoc-declaration-emit-names
Fix visibility lookup for cjs require aliases
2020-10-27 12:01:52 -07:00
Anders Hejlsberg
f9dcd9ef98 Don't cache Ternary.Maybe results when recursion is encountered during variance measurement (#41218)
* Don't record Ternary.Maybe results in cache during recursive variance measurement

* Add regression test

* Accept new baselines

* Use Ternary.Unknown to signal variance recursion

* Add comments

* Fix comment
2020-10-27 10:53:13 -07:00
Wesley Wigham
2abc8bd3fa Limit binding element visibility painting to those biding elements which are declarations of aliases 2020-10-26 16:47:43 -07:00
Wesley Wigham
ef810f5d02 Fix visibility lookup for cjs require aliases 2020-10-26 14:37:35 -07:00
Wesley Wigham
94b0e0e389 Merge pull request #41190 from weswigham/handle-binding-element-aliases
Handle the new js binding element alias symbols in JS declaration emit
2020-10-23 10:31:08 -07:00
Wesley Wigham
3bbc963303 Style feedback 2020-10-22 16:42:35 -07:00
Anders Hejlsberg
d1f87d18b1 Support partial reverse mapped inferences with tuple types (#41106)
* Support partial reverse mapped inferences with tuple types

* Add tests

* Accept new baselines
2020-10-22 11:27:41 -07:00
Vincent Boivin
010ffdc121 New error format (#40974) 2020-10-21 15:02:49 -07:00
Eli Barzilay
fe7ec1ee2e Tracing work
* Fix: `E` events need to have the same information that is on the
  corresponding `B` events.  (Superseded below.)

* Use `I` (not `i`) for instant events, so they show in devtools
  too.  (Though they don't go through the flame chart as they do in
  `about://tracing`, so they're not nearly as useful.)

* Abstract the code that writes the records in a single `writeEvent`
  local function.

* Make `args` optional, and default to `undefined` (which will not add
  them) at all.

* Drop the `{ "ts": ... }` wrapper around the `args`, after verifying
  that having arguments with names like `begin`, `end`, `pos`, `id`
  doesn't interfere with either UIs.

* Add `tracing.push`/`tracing.pop` for complete events, change a few
  `.begin`/`.end` to use these.  (The caveat is that until there's an exit
  handler to dump unterminated events, these won't show in the dump.  When
  that's done the push/pop variant can be used everywhere.)

* Add meta lines to name the process and the thread, and a line that
  avoids the warning when opening in devtools.
2020-10-21 17:31:33 -04:00
Wesley Wigham
6dde1621cb Track control flow for comma expressions in call expressions 2020-10-21 12:31:29 -07:00
Anders Hejlsberg
5d021b401a Don't reduce 'keyof M' for mapped types with non-distributive 'as' clauses (#41186)
* Don't reduce 'keyof M' for mapped types with non-distributive as clauses

* Add regression test

* Accept new baselines
2020-10-21 12:16:46 -07:00
Wesley Wigham
f4255dd237 Handle the new js binding element alias symbols in JS declaration emit 2020-10-21 11:24:19 -07:00
Wesley Wigham
aa9445bc15 Merge branch 'master' into empty-jsx-child 2020-10-19 14:54:20 -07:00
Wesley Wigham
b8dfa28ca8 Do not consider empty jsx expressions semantically important children 2020-10-19 13:34:16 -07:00
Anders Hejlsberg
4638c685b1 Properly reduce intersections of string literal and template literal types (#41162)
* Properly reduce single element intersections

* Add regression test

* Accept new baselines
2020-10-19 13:05:29 -07:00
Anders Hejlsberg
3918e6c535 Move anonymous type instantiation cache from AST node to root type (#41084)
* Move anonymous type instantiation cache from AST node to root type

* Use "root" type reference as cache location for deferred type references

* Add test

Co-authored-by: Andrew Branch <andrew@wheream.io>
2020-10-19 07:26:48 -07:00
Wesley Wigham
ce1947b0be Merge pull request #41070 from weswigham/use-minimal-endings-in-bundled-declaration-emit
Use minimal endings when generating declarations for js
2020-10-14 15:29:50 -07:00
Wesley Wigham
84726be01a Merge pull request #40597 from weswigham/allow-instanceof-array-to-narrow-readonly-array
Handle the mapping between Array and ReadonlyArray in isTypeDerivedFrom
2020-10-13 15:08:17 -07:00
uhyo
58781b0d41 allow type narrowing with NonNullExpression 2020-10-13 13:00:09 +09:00
Wesley Wigham
1cdb621257 Use minimal endings when generating declarations for js 2020-10-12 16:01:32 -07:00
Wesley Wigham
34fb470087 Merge branch 'master' into spread-compact-literals 2020-10-12 14:10:51 -07:00
Andrew Branch
a09a7144e7 Fix crash resolving ImportTypeNode in JSDoc (#40838) 2020-10-12 09:33:39 -07:00
Alex T
05be3b421a fix: show deprecated error for alias (#40961) 2020-10-12 08:45:08 -07:00
Nathan Shively-Sanders
a109b5d5c8 Fix relative paths in commonjs decl emit w/property access (#40986)
```js
const x = require('./foo').y
```

was incorrectly using the unmangled require path as the temp name in
emit:

```
import ./foo_1 = require('./foo')
import x = ./foo_1.y
```

It now uses the imported identifier:

```
import x_1 = require('./foo')
import x = x_1.y
```

Discovered while fixing #37832
2020-10-09 16:32:57 -07:00
Wesley Wigham
39c2a09b1f Fix crash due to unchecked cast in addImplementationSuccessElaboration 2020-10-09 10:53:59 -07:00
Wesley Wigham
f324fde873 Fix lint 2020-10-08 17:34:06 -07:00
Wesley Wigham
de204430ec PR feedback 2020-10-08 17:17:06 -07:00
Wesley Wigham
6b29f36674 Rename variable 2020-10-08 16:14:47 -07:00
Wesley Wigham
a49099fd15 Add elaboration when call fails all overloads but succeeds against the implementation signature 2020-10-08 14:55:14 -07:00
Nathan Shively-Sanders
cf3e28ea66 Revert "feat(40197): handle uncalled function checks in binary expressions (#40260)"
This reverts commit eaf4f46c17.
2020-10-07 14:14:49 -07:00