Component commits:
ad3af6cbf6 Fix completions when the ts installation and project are on two different windows drive Fixes#35512
165758f6e8 Fix typo
Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
Component commits:
7c31be3b17 Fix binding of this-assignments w/computed properties
Top-level this-assignments do not support computed properties. But the
binder forgets to check for computed properties and tries to bind them
normally. This hits a helpful assert.
This change stop binding this-properties with computed properties at the
top-level. There's nothing sensible we could do with them; we're unable
to late-bind entries to the global scope or to modules.
When using `{import('./b').FOO}` which is defined as a string literal,
`valueType` doesn't have a `symbol`. Leave it for the fallback value
for now.
This was exposed in 8223c0752.
Fixes#34869.
Component commits:
5810765259 Emit defineProperty calls before param prop assignments
Note that I restricted this to --useDefineForClassFields is true.
Nothing changes when it's off. I think this is the correct fix for a
patch release.
However, in principal there's nothing wrong with moving parameter
property initialisation after property declaration initialisation. It
would be Extremely Bad and Wrong to rely on this working:
```ts
class C {
p = this.q // what is q?
constructor(public q: number) { }
}
```
But today it does, and probably somebody relies on it without knowing.
ec7959091a Put parameter property initialiser into defineProperty's value
be863550b7 Merge branch 'master' into fix-defineProperty-parameter-property-emit
8ff59b98b8 Combine ES5/ESNext into one test
Component commits:
8ae5a8cfce useDefineForClassFields skips emit of ambient properties
Previously:
```ts
class C {
declare p
}
```
would incorrectly emit
```js
class C {
constructor() {
Object.defineProperty(this, "p", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
}
}
```
when useDefineForClassFields was turned on (for targets <ESNext).
0ec9c04896 Fix bug for ESNext as well
This moves the check earlier in the pipeline.
e1aa034a7a update baselines
Component commits:
62aad54b98 Fix a crash when transforming functions in modules.
When transforming a module declaration and block, parse tree nodes
contained in the module block have their parent pointers reset due to
`shouldEmitModuleDeclaration` calling into `isInstantiatedModule`, which
needs to set parent pointers to operate.
That causes a crash when later transforming any nodes within the module,
as retrieving their source file in `getSourceFileOfNode` (via
`getOrCreateEmitNode`) fails, due to their new synthesized parent nodes
not being in a source file.
This change avoids the issue by using the parse tree node in `ts.ts` to
decide whether a module declaration should be emitted (i.e. whether the
module contains values).
This means transformers cannot add values to modules that previously did
not contain any.
Fixes#34644.
Component commits:
dfa4bc0d75 Use empty object for invalid package json contents instead of undefined Fixes#34726
4d035ba5f8 Behave as if package json doesnt exist in case of invalid json in package json
Component commits:
f6dbbfd80d Fix alias naming and structure bugs in js declarations
3005f18da5 Merge branch 'master' into fix-js-declaration-bugs
3bd49e49a7 Add another test case and change condition for ns merge to require signature or export content
ca5f764c8d Fix typo in comment
Component commits:
2e0b4513ef Add isIntersectionConstituent to relation key
isIntersectionConstituent controls whether relation checking performs
excess property and common property checks. It is possible to fail a
relation check with excess property checks turned on, cache the result,
and then skip a relation check with excess property checks that would
have succeeded. #33133 provides an example of such a program.
Fixes#33133 the right way, so I reverted the fix at #33213Fixes#34762 (by reverting #33213)
Fixes#33944 -- I added the test from #34646
14d7a44c50 Merge branch 'master' into add-isIntersectionConstituent-to-relation-key
ea803620ec Update comments in test
0764275c30 Merge branch 'master' into add-isIntersectionConstituent-to-relation-key
* resolve require with entity name postfix
For example, `require("x").c`. This is the value equivalent of
`import("x").a.b.c`, but the syntax tree is not as nicely designed for
this purpose.
Fixes#34802
* Add bug number to test
* Add optional chain test
Component commits:
2e435ae3b0 Fix incorrectly looking for position in call/new expression arguments when looking for indentation of type arguments Fixes#32487
0bb1b40b1b Update src/services/formatting/smartIndenter.ts
Co-Authored-By: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Component commits:
ab9bc3a55a Fix type reference to merged prototype property assignment
The constructor function code path in the return type checking of
signatures needs to pass the *merged* symbol of the declaration to
getDeclaredTypeOfClassOrInterface. Other callers of
getDeclaredTypeOfClassOrInterface do this, or used an already-merged
symbol.
Fixes#33993
Component commits:
7be925173c Exclude ?? operator from true/false literal check in createFlowCondition
b9802166ae Accept new API baselines
3d4c14c5f8 Add tests
7362545e8c Accept new baselines
2d1af77839 Address CR feedback
8f0de27784 Accept new API baselines
Component commits:
97dcbd3bb9 Avoid a crash with `@typedef` in a script file.
Scripts (as opposed to modules) do not have a symbol object. If a script
contains a `@typdef` defined on a namespace called `exports`, TypeScript
crashes because it attempts to create an exported symbol on the
(non-existent) symbol of the SourceFile.
This change avoids the crash by explicitly checking if the source file
has a symbol object, i.e. whether it is a module.
f9b7d6eaa8 Add usage of exports.SomeName typedef.
92dc69ddf0 Fix bug at bind site rather than in declare func