Skip to content

Babel 8 RC types feedback #17777

@sapphi-red

Description

@sapphi-red

💻

  • Would you like to work on this feature?

What problem are you trying to solve?

Congrats for the babel 8 RC release.
I've tried it out with @vitejs/plugin-legacy (vitejs/vite#21555). While the functionality worked fine, it seems there are some room to improve the types. Here are the list of things I noticed:

  • PluginItem and PluginObject and PresetObject is exported. But PresetItem is not exported, it would be helpful if that one is exported. Also it would be helpful if PresetTarget and PluginTarget are exported.
  • the types of plugins does not satisfy PluginItem type.
    • PluginItem type accepts (api: PluginAPI, options?: object, dirname?: string) => PluginObject
    • the types of plugins are (api: PluginAPI, options: object, dirname: string) => PluginObject<object & PluginPass<object>> (options and dirname are required)
  • the types of presets does not satisfy PresetItem type.
    • PluginItem type accepts (api: PresetAPI, options?: object, dirname?: string) => PresetObject
    • the types of plugins are (api: PresetAPI, options: Options, dirname: string) => PresetObject (options and dirname are required)

Describe the solution you'd like

Fix the type issues above.

Describe alternatives you've considered

Keep it as-is.

Documentation, Adoption, Migration Strategy

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions