10000 Inexact optional property types · Issue #499 · unjs/unplugin · GitHub
[go: up one dir, main page]

Skip to content
Inexact optional property types #499
Open
@iwoplaza

Description

@iwoplaza

Environment

  • unplugin: 6.2.2
  • typescript: 5.7.2

Reproduction

https://stackblitz.com/edit/vitejs-vite-lovdzaug?file=unplugin-foo.ts

Describe the bug

Definitions like:

type StringFilter = FilterPattern | {
	include?: FilterPattern
	exclude?: FilterPattern
};

... can cause friction when using the TypeScript exactOptionalPropertyTypes compiler option, since under that configuration, undefined is not a valid value to be passed into include or exclude. Would it break anything to widen the type to the following?:

type StringFilter = FilterPattern | {
	include?: FilterPattern | undefined
	exclude?: FilterPattern | undefined
};

Additional information

  • Would you be willing to help implement a patch for this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0