You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here, initializing is correctly logged three times.
This behavior has some implications. For example, TypeScript 5.0 supports the newest decorators proposal, and it transpiles such decorators to similar code. The following example:
When cloning instances of classes containing instance fields, their initializers are not run:
The preceding example logs
initializing
only once, even though I'd expect the log to be printed twice.This bug is not present in
klona/lite
andklona
, most likely due to the fact that they have a branch detecting constructor functions:Here,
initializing
is correctly logged three times.This behavior has some implications. For example, TypeScript 5.0 supports the newest decorators proposal, and it transpiles such decorators to similar code. The following example:
is transpiled by the TypeScript compiler as follows:
Note that some helpers (such as
__esDecorate
) were omitted for brevity.When cloning objects that use decorators using
klona/full
, initializers added viactx.addInitializer()
are not run.The text was updated successfully, but these errors were encountered: