Commit graph

31778 commits

Author SHA1 Message Date
AnyhowStep f529115b41
fixes microsoft/TypeScript#41286 (#41294)
* fixes microsoft/TypeScript#41286

* Added period to end of deprecation message

* Search Symbol.declarations for deprecated tag instead of Symbol.valueDeclaration

* renamed arg0 to deprecatedEntity, narrowed param type

* Added different deprecation message if signature is available

* address PR comments

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-01-25 13:33:28 -08:00
Wesley Wigham d7d8f33def
In bundle declaration emit, refuse to rewrite nonrelative references to files outside the common source directory (#42306) 2021-01-25 11:16:59 -08:00
Sheetal Nandi 1b57a0395e
Fix incorrectly logging ts files instead of .js files as top files (#42463)
Fixes #41071
2021-01-25 10:04:39 -08:00
Nathan Shively-Sanders ca380af99b
At starts jsdoc tag only after whitespace (#42364)
* Update tests

* @ begins JSDoc tag only after whitespace

Previously, inside a JSDoc tag's comment, @ would start a tag unless it
was surrounded by backticks. However, looking at real code showed that
only whitespace-preceded uses of @ were intended to start tags.
2021-01-25 09:42:24 -08:00
Andrew Branch 89c173fddc
Narrow via discriminant property through optional chain (#42450)
* Naive attempt at narrowing via discriminant property through optional chain

* Clean up test
2021-01-25 09:29:51 -08:00
Amin Pakseresht 290af69b73
Filter out global keywords of UMD module export declarations in completion providing auto import suggestions (#42141)
* Add AutoImportSuggestions for UMD module export declarations instead of global keywords

* Add test for scripts

* Add more comments

* Provide auto import suggestion only for modules and not scripts

* PR review #1

* PR review #1
2021-01-25 09:29:13 -08:00
Orta Therox 154f2094fc
WIP-semantic in session based TS (#42438) 2021-01-23 13:13:56 +00:00
TypeScript Bot 63003eb106 Update package-lock.json 2021-01-23 06:50:09 +00:00
Ron Buckton 786a7e86ef
Update user baselines (#42451)
* Update user baselines +cc @sandersn

* Update user baselines

Co-authored-by: typescript-bot <typescript@microsoft.com>
2021-01-22 18:44:25 -08:00
Ron Buckton ee3fe472d7
Fix broken user and docker tests (#42431)
* Add --force to npm install script for user tests

* Migrate prettier to docker

* Fix vscode Dockerfile

* Fix stack space issue in isJSLiteralType

* Use --legacy-peer-deps based on npm version

* Fix xterm.js Dockerfile
2021-01-22 13:23:41 -08:00
Sheetal Nandi 80dfc6a45b
Only when typings file change for the project, schedule the update for the project (#42428)
* Update and add test when typings dont change because of import name

* Update project scheduling only when typings are set

* Schedule update graph only if typings change
Fixes #39326
2021-01-22 11:16:07 -08:00
TypeScript Bot 4c62f6e7d6 Update package-lock.json 2021-01-22 06:51:52 +00:00
Wesley Wigham 71d4ee5d60
Preserve alias information where possible when looking up union and intersection base constraints (#42430) 2021-01-21 13:06:56 -08:00
TypeScript Bot 2f47527b99 Update package-lock.json 2021-01-21 06:51:56 +00:00
Matt Kantor 424b805d61
Fix "Cannot find name 'global'. Did you mean 'global'?" (#42262)
* Add tests for "Cannot find name 'global'. Did you mean 'global'?"

* Fix "Cannot find name 'global'. Did you mean 'global'?"

* Add an additional test case for spelling suggestions of "global".

* Name the boolean for suggestions being global scope augmentations.
2021-01-20 15:23:34 -08:00
Andrew Branch 0383b5cb4c
Optimize import fixes for projects with many symlinks (#42150)
* Create symlink cache when a pnpm module is found

* Keep pnpm-internal symlinks out of the symlink cache

* Filter out  pnpm path from realpath module specifier too

* Optimize symlink module specifier generation

* Add trailing directory separators

* Remove unneeded change

* Fix paths losing case in cache

* Fix missing absolutification
2021-01-20 12:15:36 -08:00
TypeScript Bot 9d286a21ae
Update user baselines +cc @sandersn (#42366)
Co-authored-by: typescript-bot <typescript@microsoft.com>
2021-01-20 08:51:28 -08:00
Anders Hejlsberg 028f14c507
Filter origin types when filtering union types (#42378)
* When filtering a union type, also filter its origin type, if any

* Accept new baselines
2021-01-20 06:37:02 -10:00
Armando Aguirre a231b23772 Fix start position on JSDoc parsin 2021-01-19 23:02:56 -08:00
TypeScript Bot 1cef53f9f5 Update package-lock.json 2021-01-20 06:52:39 +00:00
Wesley Wigham 0d494abc77
Add missing unwrap call for the inferredExtendsType (#42409) 2021-01-19 18:02:35 -08:00
Armando Aguirre 98e9e77255 Fixed JSDoc with only one asterisk in comment 2021-01-19 15:55:01 -08:00
Zuckjet 147384c932
Fix typos in comments (#42396) 2021-01-19 09:13:26 -08:00
TypeScript Bot b34e680cd0 Update package-lock.json 2021-01-19 06:51:13 +00:00
Wesley Wigham 621e0afe00
Accept merge-conflicted baseline (#42398) 2021-01-18 07:05:11 -08:00
TypeScript Bot 852c7027e9 Update package-lock.json 2021-01-18 06:50:43 +00:00
TypeScript Bot b5bab16a96 Update package-lock.json 2021-01-16 06:49:45 +00:00
Anders Hejlsberg 70c82cab75
Include alias type arguments in keys for aliased types (#42365) 2021-01-15 16:00:55 -10:00
Wesley Wigham ab32fcadbd
Fix type parameter lookup for TypeAlias LibraryManagedAttributes (#42245) 2021-01-15 17:23:01 -08:00
chenjigeng d1e1e9dccc
Feat/exclude completions of variable initializers (#42087)
* feat: exclude declared variable when Object literal completions

* feat: check undeclareVariable when completion

* feat: add completion test case

* feat: code optimization

* feat: support shorthand property assignment

* feat: add shorthand property assignment test case

* feat: update completionPropertyShorthandForObjectLiteral test cases

* feat: exclude completions of variable initializers

* feat: update test cases

* feat: add completionListWithoutVariableinitializer test case

* feat: perfect the completionListWithoutVariableinitializer test case

* feat: remove isIdentifier limit

* feat: update test cases

* feat: code optimization and filter out some binding cases

* feat: update test case

* feat: handle arrow function expressions without braces

* feat: add arrow function expressions without braces test case

* feat: check node.parent exist first

* feat: optimization name

* feat: optimize test cases

* chore: code formatting

* feat: perfect type
2021-01-15 15:57:18 -08:00
TypeScript Bot 0aa77fcea7
Update user baselines +cc @sandersn (#41496)
Co-authored-by: typescript-bot <typescript@microsoft.com>
2021-01-15 15:42:23 -08:00
Oleksandr T 8324dec9e9
feat(33715): include methods of class defined in a property (#42164) 2021-01-15 09:52:46 -08:00
TypeScript Bot 22f8fa443b Update package-lock.json 2021-01-15 06:49:09 +00:00
Armando Aguirre 995023c2a7 Fix double asterisk formatting in JSDoc 2021-01-14 21:50:22 -08:00
Oleksandr T c83f769850
fix(41405): allow using property access as reference to function (#41429) 2021-01-14 17:02:48 -08:00
Andrew Branch 33ea6c581a
Fix indentation for closing > of ExpressionWithTypeArguments (#42341) 2021-01-14 14:48:40 -08:00
Chris West 368cdfd29a
fix: const enums + isolatedModules emit invalid code (#41933)
* chore: failing test for const enums and isolatedModules

* fix: const enums + isolatedModules emit invalid code

In `isolatedModules` mode, the compiler does not inline const enums,
but also decides not to `import` them, leaving invalid code that
throws a `ReferenceError` at runtime.

This code:

```
import { SomeEnum } from './bar';
sink(SomeEnum.VALUE);
```

..should compile to either:

```
var { SomeEnum } = require('./bar');
sink(SomeEnum.VALUE);
```

..or (with const enum inlining):

```
sink(1 /* VALUE */);
```

..but actually compiles to:
```
sink(SomeEnum.VALUE);
```

..with no imports, which throws a ReferenceError at runtime.

---

The compiler has already realised that the symbol is a referenced const
enum, it just doesn't use this information when it comes to deciding
whether to emit an import. This commit additionally checks that
information, if we are compiling in isolatedModules mode.

---

In my opinion, this is not the correct fix, but it is the simplest. In
`isolatedModules` mode, `const enum` should probably be a compile error
(because there are no benefits and the complexity is high, and,
apparently, buggy). If not, the compiler should not be checking whether
something is a const enum, and should just be treating it as a regular
enum, and checking as if it was?

Fixes #40499.

* chore: extra test for type-only

* feat: explicitly ban --isolatedModules --preserveConstEnums false

* feat: isolatedModules implies preserveConstEnum

* Update src/compiler/diagnosticMessages.json

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>

* chore: compiler test for argument incompatibility

* Add and fix test for namespace import of const enum

* Fix additional bug with reexport of const-enum-only module

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
Co-authored-by: Andrew Branch <andrew@wheream.io>
2021-01-13 15:51:08 -08:00
Klaus Meinhardt 9171aa5a1b
fix forEachChildRecursively (#42300) 2021-01-13 03:20:46 -08:00
Andrew Branch 33046e389a
Do not suggest paths inside node_modules/.pnpm as module specifiers (#42095)
* Create symlink cache when a pnpm module is found

* Keep pnpm-internal symlinks out of the symlink cache

* Filter out  pnpm path from realpath module specifier too

* Use ignoredPaths instead of pnpm-specific path
2021-01-12 14:04:03 -08:00
Nathan Shively-Sanders 2f5863754f
Improve naming of hasNonBindableDynamicName (#42297)
hasNonBindableDynamicName

1. Has 'non' in the name, and is only ever used negated.
2. Is true for a case that's not reflected correctly in the name -- it's
true for non-dynamic names as well.

I considered hasEarlyOrLateBindableName, but decided to use
hasBindableName for now.
2021-01-12 13:15:54 -08:00
Wesley Wigham c3dd845923
Better detect when typical nondistributive conditionals need to be defered by unwrapping their check and extends types (#42248) 2021-01-12 12:59:52 -08:00
Oleksandr T a276a6dce7
feat(31388): allow binding elements starting with an underscore (#41378) 2021-01-12 10:59:08 -08:00
TypeScript Bot a894f8ad2b Update package-lock.json 2021-01-12 06:43:39 +00:00
Andrew Branch b0f5e35777
'in' should not operate on primitive types (#41928 + @andrewbranch) (#42288)
* 'in' should not operate on primitive types

* accept baselines of failing tests

* review

* update error message

* check if constraint of right type is assignable to a non primitive or instantiable non primitive

* do not throw errors where narrowing is impossible

* accept baselines

* fix test case failures

* Add more accurate comment discussion and document failing edge case in test

* Update baselines

Co-authored-by: Jonas Hübotter <jonas.huebotter@gmail.com>
2021-01-11 16:46:08 -08:00
Anders Hejlsberg c456bbd466
Support re-aliasing of type alias instantiations (#42284)
* New aliases for type alias instantiations

* New aliases for conditional, mapped, and anonymous object type instantiations

* Accept new baselines

* Fix issues with re-aliasing

* Accept new baselines
2021-01-11 13:29:46 -10:00
Oleksandr T 1ecf22884f
fix(42166): allow assertion signature for private identifiers (#42176) 2021-01-11 09:25:51 -08:00
TypeScript Bot 8ddea6b7a6 Update package-lock.json 2021-01-11 06:41:19 +00:00
Daniel Rosenwasser 79c72751df Update baselines. 2021-01-10 15:58:58 -08:00
Daniel Rosenwasser 16031bc429 Update LKG. 2021-01-10 15:58:40 -08:00
Oleksandr T 1cd8ee4b8d
fix(42088): fix crash on unreachability condition in for statement (#42110) 2021-01-10 15:42:39 -08:00