Skip to content

fix: relax Emitter generic constraint to object for TS strict compat - #220

Open
xusuxiang8 wants to merge 1 commit into
developit:mainfrom
xusuxiang8:fix-ts-strict-generics
Open

fix: relax Emitter generic constraint to object for TS strict compat#220
xusuxiang8 wants to merge 1 commit into
developit:mainfrom
xusuxiang8:fix-ts-strict-generics

Conversation

@xusuxiang8

Copy link
Copy Markdown

Fixes #209

Change the Emitter generic constraint from Record<EventType, unknown> to object so that user-defined Events types without a string index signature satisfy the constraint under TypeScript strict mode.

Example:

// Before: Type 'Events' does not satisfy the constraint 'Record<EventType, unknown>'
interface Events {
  foo: string;
}
const emitter: Emitter<Events> = mitt<Events>();

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

Successfully merging this pull request may close these issues.

TypeScript complains when trying the provided typescript example

1 participant