Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Imports types that are not defined on `build --stub`

Đang mở
#223 5 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
nuxt, typescript
Lĩnh vực
build-system

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện vấn đề với nuxt-module-build build --stub và so sánh types.d.mts được tạo ra với đầu ra từ nuxt-module-build build. Theo dõi cách khai báo stub import và re-export các type của module. Được xem là hoàn tất khi đầu ra của stub chỉ tham chiếu đến các type được export từ ./module và khớp với đầu ra build hợp lệ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

question

Running nuxt-module-build build --stub generates types.d.mts like:

import type { ModuleOptions, ModuleHooks, RuntimeModuleHooks, ModuleRuntimeConfig, ModulePublicRuntimeConfig } from './module'

declare module '#app' {
  interface RuntimeNuxtHooks extends RuntimeModuleHooks {}
}

declare module '@nuxt/schema' {
  interface NuxtConfig { ['sentry']?: Partial<ModuleOptions> }
  interface NuxtOptions { ['sentry']?: ModuleOptions }
  interface NuxtHooks extends ModuleHooks {}
  interface RuntimeConfig extends ModuleRuntimeConfig {}
  interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {}
}

declare module 'nuxt/schema' {
  interface NuxtConfig { ['sentry']?: Partial<ModuleOptions> }
  interface NuxtOptions { ['sentry']?: ModuleOptions }
  interface NuxtHooks extends ModuleHooks {}
  interface RuntimeConfig extends ModuleRuntimeConfig {}
  interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {}
}


export type { default } from './module'

where the "ModuleHooks, RuntimeModuleHooks, ModuleRuntimeConfig" imports are not exported from "./module".


Running nuxt-module-build build generates correct version:

import type { ModuleOptions, ModulePublicRuntimeConfig } from './module'


declare module '@nuxt/schema' {
  interface NuxtConfig { ['sentry']?: Partial<ModuleOptions> }
  interface NuxtOptions { ['sentry']?: ModuleOptions }
  interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {}
}

declare module 'nuxt/schema' {
  interface NuxtConfig { ['sentry']?: Partial<ModuleOptions> }
  interface NuxtOptions { ['sentry']?: ModuleOptions }
  interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {}
}


export type { ModuleOptions, ModulePublicRuntimeConfig, default } from './module'
Ngôn ngữ chính
TypeScript
Star
276
Fork
35
Merge trung bình
2 giờ 46 phút
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của nuxt/module-builder

Tất cả issue của nuxt/module-builder

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.