* Adds support for looking up past Blocks in expando objects
* Adds JS tests to validate the JS parsing also works
* Get the top level block expando tests green
* Shared early couldContainTypeVariables check in instantiateType
* Defer creation of map object in createUnionOrIntersectionProperty
* Types with top-level non-generic type alias reference no type variables
* Use CFA to determine types of properties declared by this.xxx assignments
* Accept new baselines
* Also use CFA in constructor functions
* Accept new baselines
* Fix lint error
* Only widen fresh literal types in CFA of assignment to auto-typed
* Auto-typing for declared properties with no type annotation or initializer
* Add optionality if declaration includes '?' modifier
* Always use CFA for properties with no initializer in .js files
* Small fix
It's always supposed to have been this way, but I was worried about how
breaky the change would be when adding globalThisType. This PR is
experiment to see how much.
Fixes#35882 maybe
* Handle undefined in indent helper
Telemetry shows that it's called with undefined (probably `stderr` in an
error scenario?).
* Add undefined to parameter type
* 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.
* Remove needless structure/destructuring
Just pass multiple arguments! Sheesh!
* Basic working prototype
* Cleaned up version
1. Add test
2. Change protocol. navto-all only happens when filename is undefined or
missing.
3. Change location to earlier code path. This change was largely
type-guided and resulted in some duplicated code, but I think it's less
fault-prone.
* remove temp notes
* Single-project hits if projectFileName is provided
and file is not
* use original code as fallback
* Remove superCallShouldBeFirst error
It seems redundant since TS gives an error on any use of `this` before
super, and non-`this` uses before `super` should be fine.
Fixes#37371
* Revert "Remove superCallShouldBeFirst error"
This reverts commit 3c09153c8a.
* error except for target:"esnext" && useDefineForClassFields
* Fix use-before-def with methods on esnext+useDefineForClassFields
It was incorrectly flagging methods as used before their definition, but
this is allowed under any emit.
* Add instance function test case