Component commits:
9795fa6631 Improve assert message in binder
Looking at the code, I don't think the assert can ever fire, but it
clearly does, or did in the past. This will make it easier for people to
create a repro.
d815effa9b fix lint
add6bbcfce Use BindableStaticNameExpression not BindableStaticAccessExpression
This type does allow identifiers, but those are ruled out earlier, so I added
an assert for that case.
Component commits:
6fe4be21e4 Exclude arrays and tuples from full intersection property check
9019e399e5 Add regression test
Co-authored-by: Anders Hejlsberg <andersh@microsoft.com>
Component commits:
99c5c096c5 Properly finalize evolving array type in getTypeAtFlowCall
b355cd4da4 Add regression test
Co-authored-by: Anders Hejlsberg <andersh@microsoft.com>
* Property handle private/protected properties in unions of object types
* Add regression test
Co-authored-by: Anders Hejlsberg <andersh@microsoft.com>
Component commits:
956ac2132a Allowed comment directives to be multiline
12749c9291 Added tests, and perhaps fixed a test runner bug?
99bb366fd6 I think it's going to need a consistent variable to loop over
a21477d6ac Used dynamically computed indexes in verifies
992441d9b8 Added multiline tests
199d256ba2 Increased flexibility for multiline comment parsing
65a7587432 Undid a couple of formatting changes; removed backslashes from multiline regexp
036a4ae922 Merge branch 'master'
b620104be2 Merge branch 'master' of https://github.com/microsoft/TypeScript into multiline-comment-directives
Co-authored-by: Orta Therox <orta.therox@gmail.com>
* Cherry-pick PR #38273 into release-3.9
Component commits:
c80c177b44 Harden node builder APIs to no longer return `undefined` for a node when `NodeBuilderFlags.IgnoreErrors` is provided
* Undo API changes for release branch
Co-authored-by: Wesley Wigham <t-weswig@microsoft.com>
Co-authored-by: Wesley Wigham <wwigham@gmail.com>
Component commits:
b664c3dc6b Fix jsdoc variadic type nodes not being remapped to equivalent TS in output
Co-authored-by: Wesley Wigham <t-weswig@microsoft.com>
Component commits:
17f0dfbf9c fix(38177): add auto-import for missing argument type in new functions/methods
Co-authored-by: Alexander T <alexander.tarasyuk@outlook.com>
* Filter out edits that are no-ops in 'organize imports'.
* Updated tests for 'organize imports'.
* Always remove no-op changes from the change tracker.
* Add a new `stringContainsAt` helper function to avoid traversing the entire file contents.
* Combine `map`/`filter` sequence into `mapDefined`.
* Fix up documentation.
* Prefer a likely literal over anonymous type in --noImplicitAny codefixes
Before trying to make an anonymous type for a type's usage, we'll first check if there is exactly one builtin primitive the usage is assignable to, and use it if so. Right now that's only `number` and `string` because `boolean` has no distinguishable members.
A couple of implementation details:
* `tryInsertTypeAnnotation` needed to know to insert a type _after_ a node's `exclamationToken` if it exists
* This code area was written before `??` 😉
* Used unknown/any instead of void when applicable
* Fix little whitespace change in tests/cases/fourslash/codeFixInferFromUsagePropertyAccessJS.ts
* Undid some now-unnecessary unknown additions
* Took advice on restricting void to just call expressions
initialiser. But this is only correct when the initialiser is for a
parameter. For example:
```ts
declare let x: { s: string } | undefined;
const { s } = x;
```
This PR removes undefined from the type of a binding pattern only when
the binding pattern's parent is a parameter. This fixes the regression
from 3.8. However, it's still not the ideal fix; we should be able to
use control flow to solve this problem. Consider:
```ts
const { s }: { s: string } | undefined = { s: 'hi' }
declare function f({ s }: { s: string } | undefined = { s: 'hi' }): void
```
Neither line should have an error, but the first does in 3.8 and after
this change.