Closed
Description
Accessor With init
const append = (s: string) =>
(target, c) => {
return {
set(v) {
target.set.call(this, `${v}${s}`);
},
init(v) {
return `${v}${s}`;
}
}
}
class C {
@append("C")
@append("B")
accessor x = "a";
}
const obj = new C();
obj.x = "z";
console.log(obj.x);
-
Logs
cBC zCB
-
Counter-intuitive - would have hoped that it was
zCB
for both. -
Stage 3 2023 decorators allow you to provide a replacement
get
,set
, andinit
method.- The initializers are run in the opposite order of setters.
-
Feels like existing behavior might be right?
-
Depends on your interpretation. For
class X { @A @B x = C; }
Do you think of
A(B(x = C))
, or do you think ofA(B(x)) = C
-
-
We generally support making set and init consistent based on the argument that both of the
=
orders should be the same.class C { @A @B x = 1; constructor() { x = 1; } }
Isolated Modules on Global/Script Files
isolatedModules
used to error on code that didn't have animport
orexport
- In 5.0, we removed the restriction and just said "you're not allowed to have things like
namespace
s, but you can have script code" - But our emit changes based on
isolatedModules
, and this becomes more obvious if you use AMD as a module target. - If you were using
transpileModule
, you never got an error anyway?- Actually, it does provide diagnostics - and if people didn't check their diagnostics, that's not on us.
- Well, we're not seeing diagnostics.
- Something in
Program
we're not including.
- Something in
- Feels like there could be some wiggle-room for enabling the scenario in
verbatimModuleSyntax
ifisolatedModules
wasn't on. - What we want:
- Let's not add more
isolatedModules
-driven emit changes.
- Let's not add more
- We want the PR - but need to note this in the release notes
Reverting Deferral of Checking Assertion Expressions
- Removing a circularity error depended on deferring work - but that's caused a 1-2% regression.
- Seems like a band-aid, felt like it's not worth it.
- Deferring is a strategy for avoiding circularities in a lot of common cases.
- Feels like maybe there's an opportunity to more-cheaply defer the work.
- We had tried
checkExpression
just once - but increased time checking xstate - Also tried
checkExpressionCached
- but that breaks our own codebase - but that resets CFA to avoid poisoning the cache. - Could try to remember the expression type from
NodeLinks
. - Let's try to win back the perf here.