jit: true in decorator metadata tells ngtsc not to compile the class ahead of time. ngtsc leaves the decorator in place (it is downleveled by TS) so the JIT compiler handles it at runtime. OXC ignores the flag and compiles the class AOT anyway.
Repro
import {Component} from '@angular/core';
@Component({jit: true, selector: 'c', template: '<div>{{x}}</div>'})
export class C { x = 1; }
OXC (main and #504 tip)
export class C { x = 1;
static ɵfac = function C_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || C)(); };
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({type:C,selectors:[["c"]],decls:2,vars:1,template:function C_Template(rf, ctx) {...},encapsulation:2});
}
// + ɵsetClassDebugInfo, ɵsetClassMetadata(C,[{type:Component,args:[{jit:true,selector:"c",template:"<div>{{x}}</div>"}]}],null,null)
.d.ts: ɵfac + ɵcmp declarations.
ngtsc 22.1.7
let C = class C {
x = 1;
};
C = __decorate([
Component({ jit: true, selector: 'c', template: '<div>{{x}}</div>' })
], C);
.d.ts: only x: number; (no Ivy fields).
@Directive({jit: true, ...}) and @NgModule({jit: true}) behave the same way: ngtsc leaves the decorator, OXC emits ɵdir / ɵmod.
ngtsc source (v22.0.0)
annotations/directive/src/shared.ts extractDirectiveMetadata: if (directive.has('jit')) return {jitForced: true};
annotations/directive/src/handler.ts and annotations/component/src/handler.ts: on jitForced, register for JIT and skip analysis.
annotations/ng_module/src/handler.ts: if (ngModule.has('jit')) ...
On main?
Yes.
Direction
When the decorator has jit: true, run that class through the existing JIT downlevel path (TransformOptions::jit) instead of AOT, and emit no Ivy .d.ts members for it. The rest of the file is still compiled AOT.
jit: truein decorator metadata tells ngtsc not to compile the class ahead of time. ngtsc leaves the decorator in place (it is downleveled by TS) so the JIT compiler handles it at runtime. OXC ignores the flag and compiles the class AOT anyway.Repro
OXC (main and #504 tip)
.d.ts:ɵfac+ɵcmpdeclarations.ngtsc 22.1.7
.d.ts: onlyx: number;(no Ivy fields).@Directive({jit: true, ...})and@NgModule({jit: true})behave the same way: ngtsc leaves the decorator, OXC emitsɵdir/ɵmod.ngtsc source (v22.0.0)
annotations/directive/src/shared.tsextractDirectiveMetadata:if (directive.has('jit')) return {jitForced: true};annotations/directive/src/handler.tsandannotations/component/src/handler.ts: onjitForced, register for JIT and skip analysis.annotations/ng_module/src/handler.ts:if (ngModule.has('jit')) ...On main?
Yes.
Direction
When the decorator has
jit: true, run that class through the existing JIT downlevel path (TransformOptions::jit) instead of AOT, and emit no Ivy.d.tsmembers for it. The rest of the file is still compiled AOT.