dts: `typeof X` references in ɵmod / hostDirectives use local names with no import (TS2304 in published .d.ts)

Aberta
#692 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
48/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
rust, typescript

Direção de pesquisa

Start in dts.rs at the formatter locations listed in the issue: lines 392, 406, 420, 720, and 769. Trace how declarations are generated for ɵmod members and hostDirectives, then check the bundled and unbundled examples against the emitted .d.ts files. Done means referenced classes, including aliased host directives, resolve for consumers without skipLibCheck; add or run focused declaration emit tests for those cases.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

Found while reviewing #683. The member text comes from the compiler (dts.rs), so both the asset and chunk paths ship it.

ngtsc writes references to other classes in .d.ts members as typeof i1.X with import * as i1 from "./x". Oxc writes the local name with no import: format!("typeof {}", …) at dts.rs:392/406/420 (ɵmod declarations / imports / exports) and dts.rs:720/769 (hostDirectives). The name only resolves if that class happens to be declared in the same .d.ts under the same name. Declaration emit drops imports only used by decorators, so it often isn't.

A. bundled (rolldown-plugin-dts), index.ts exports only LibModule
   static ɵmod: i0.ɵɵNgModuleDeclaration<LibModule, never, [typeof InternalComponent], [typeof InternalComponent]>;
   → InternalComponent is not declared in index.d.ts → consumer tsc: TS2304 Cannot find name 'InternalComponent'

B. tsdown unbundle: true
   lib.module.d.mts: [typeof HelloComponent, typeof HighlightDirective], no import of either → 4× TS2304

C. aliased host directive: import { HighlightDirective as HD } …; hostDirectives: [{ directive: HD }]
   [{ directive: typeof HD; … }]  → no `HD` in the emitted .d.ts → TS2304 (or `any` with skipLibCheck)

With skipLibCheck: true the errors go away, but the types become any, so the consumer's Angular compiler can't see the module's exported components.

Linguagem predominante
Rust
Estrelas
245
Forks
26
Merge médio
1d 42min
PRs com merge (30d)
83

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de voidzero-dev/oxc-angular-compiler

Todas as issues de voidzero-dev/oxc-angular-compiler

Issues semelhantes

Mais issues de Rust

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.