Skip to content

DI: import type tokens promoted to runtime value imports #288

@brandonroberts

Description

@brandonroberts

A DI parameter typed by a type-only import (import type { X } or import { type X }) is promoted to a value import and used as a runtime token.

Repro

import { Component } from '@angular/core';
import type { MyService } from './my-service';
@Component({ selector: 'x', template: '' })
export class X { constructor(private svc: MyService) {} }

Actual

OXC injects import * as i1 from './my-service' and emits ɵɵdirectiveInject(i1.MyService).

Expected

A type-only import is erased and cannot be a value. Angular emits ɵɵinvalidFactory() (ValueUnavailableKind.TYPE_ONLY_IMPORT).

Impact

Breaks verbatimModuleSyntax/isolatedModules; runtime crash if the import is genuinely type-only (interface / export type).


Researched and drafted with Claude Code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions