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

オープン
#692 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust, typescript

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Rust
スター
245
フォーク
26
平均マージ
1日 42分
マージ済み PR(30日)
83

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

voidzero-dev/oxc-angular-compiler のほかの issue

voidzero-dev/oxc-angular-compiler の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。