Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enum 生成错误+注释的export也会生成 #253

Closed
5 tasks done
BryanAdamss opened this issue Aug 17, 2022 · 2 comments
Closed
5 tasks done

enum 生成错误+注释的export也会生成 #253

BryanAdamss opened this issue Aug 17, 2022 · 2 comments

Comments

@BryanAdamss
Copy link

Describe the bug

// vite.config.js

AutoImport({
      // targets to transform
      include: [
        /\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
        /\.vue$/, /\.vue\?vue/, // .vue
      ],

      // global imports to register
      /* 自动导入vue、vue-router、pinia等API */
      imports: [
        // presets
        'vue',
        'vue-router',
        'pinia',
      ],

      // Auto import for all module exports under directories
      dirs: [
        'src/services/api',
        // './hooks',
        // './composables'
        // ...
      ],

      // Filepath to generate corresponding .d.ts file.
      // Defaults to './auto-imports.d.ts' when `typescript` is installed locally.
      // Set `false` to disable.
      dts: 'types/auto-imports.d.ts',

      // Auto import inside Vue template
      // see https://github.com/unjs/unimport/pull/15 and https://github.com/unjs/unimport/pull/72
      vueTemplate: false,

    }),

// src/services/api/common.ts
export const enum CommonApi {
  PREMISSION_QUERY = '/xxx/permission/query',
}

// 我被注释了💥
// export const commented = 'commented'

// auto-imports.d.ts
// Generated by 'unplugin-auto-import'
export {}
declare global {
  ...
 // 注释的也自动生成了(这似乎不是问题)
  const commented: typeof import('../src/services/api/common')['commented']
  ...
 // enum的生成错误💥
  const enum: typeof import('../src/services/api/common')['enum']
  ...
}

Reproduction

参照描述

System Info

System:
    OS: Windows 10 10.0.18363
    CPU: (8) x64 Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
    Memory: 958.86 MB / 15.74 GB
  Binaries:
    Node: 16.16.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.11.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 104.0.5112.81
    Edge: Spartan (44.18362.449.0)
    Internet Explorer: 11.0.18362.1

Used Package Manager

pnpm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
@azaleta
Copy link
Contributor

azaleta commented Aug 18, 2022

enum
(unjs/mlly#69)

@antfu
Copy link
Member

antfu commented Feb 7, 2023

We temporarily close this due to the lack of enough information.
Please provide a minimal reproduction to reopen the issue.
Thanks.

Why reproduction is required

@antfu antfu closed this as completed Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants