* add two tests: Refactor: Remove braces from arrow function
* refactor: simplify test and add another test
* fix: copyTrailingAsLeadingComments in addOrRemoveBracesToArrowFunction
* test: add additional test
* fix: clean up changes
* fix: add check for newEdit
* fix: add function for semi colon modifier
* feat: grab all comments during refactor
* refactor: update addOrRemoveBraces logic
* fix: remove duplicate function call
* Update src/services/refactors/addOrRemoveBracesToArrowFunction.ts
* remove blank line
remove blank line
Co-authored-by: Jesse Trinity <42591254+jessetrinity@users.noreply.github.com>
* Add fastpath to isRelatedTo for type references
* Do not check intersections or unions to ignore propegating reference flags, properly set comparing jsx flag
* Re-remove unneeded check
* Just check for TypeFlags.Object
* Remove else clause
* Error on missing BigInt in ES2020 too.
Previously it was only on ESNext, but bigint ships in ES 2020.
There are no tests for this; passing `false` doesn't cause any tests to
fail at least.
* add tests
* Avoid circular reference in this-property assignments
To do this, don't check this-property assigments that have the
this-property of the lhs appearing somewhere on the rhs:
```js
class C {
m() {
this.x = 12
this.x = this.x + this.y
}
}
```
I tried suppressing the circularity error, but because we cache the
first type discovered for a property, this still results in an implicit
any for `x` in the previous example. It just doesn't have an error.
Fixes#35099
* Add test case + rename function
* Use isMatchingReference
Get the `declaration` container just once instead of in three places.
(Minor change: one place used to start looking from
`declaration.parent`, but that shouldn't make any difference.) Also,
don't pass it to the helper functions since they're local anyway.
This only applies in JS, where `@template` tags can apply to
initialisers of variable declarations:
```js
/**
* @template T
* @returns {(b: T) => T}
*/
const seq = a => b => b
```
Fixes#36201
* Consolidated extra property check with intersections
* Fix comment
* Add tests
* Properly propagate intersectionState
* Route property check through recursive type tracking logic
* Accept new baselines
* Skip check when apparent type of source is never
* Accept new baselines
* Only check when apparent type of source is a structured type
* Fix serialisation of static class members in JS
Previously static class members would be treated the same way as expando
namespace assignments to a class:
```ts
class C {
static get x() { return 1 }
}
C.y = 12
```
This PR adds a syntactic check to the static/namespace filter that
treats symbols whose valueDeclaration.parent is a class as statics.
Fixes#37289
* fix messed-up indent
* Extract function
* Fix crash for private identifier in expando assignments
It does this by disallowing private identifiers from expando assignments
entirely. I haven't thought of a scenario where they make sense, but I
haven't thought about it exhaustively either.
Fixes#37356
* Update baselines
I think the new error is probably better. It's certainly different!