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

docs: fix example in README #18

Merged
merged 1 commit into from
Aug 6, 2024
Merged

docs: fix example in README #18

merged 1 commit into from
Aug 6, 2024

Conversation

jwbth
Copy link
Contributor

@jwbth jwbth commented Aug 3, 2024

Using an interface to define events triggers a TypeScript error:

Type 'Events' does not satisfy the constraint 'EventMap'.
Index signature for type 'string' is missing in type 'Events'.

This is due to a peculiar behavior of TypeScript compiler that only allows use of types in such curcumstances (see microsoft/TypeScript#15300).

So I replaced the interface with a type. (A type is actually already used in another example above.)

Playground link

Using an interface to define events triggers a TypeScript error:
> Type 'Events' does not satisfy the constraint 'EventMap'.
>   Index signature for type 'string' is missing in type 'Events'.
This is due to a peculiar behavior of TypeScript compiler that only allows use of types in such curcumstances (see microsoft/TypeScript#15300).

So I replaced the interface with a type. (A type is actually already used in another example above.)

[Test in TS playground](https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgURMGMCmU4F84BmUEIcA5AM4xTADGMAtJgG6YB2jmaG2ZAUHwD0guAEYAdHAAimAsDaY4AQzZx5WKASW1FMABZL4AE0wVaNAEam4ATwgBXHC3YwK4oSIDKmeM45w2JRBrJQo4fUUAa0wbCgAaZTYjcL1MYCcADzBMekxksCUbABsIJSMw0LhmJSL7U3cYG2yUVg4wgF5EPjg4Wgg2BXoALjgAbWAjEaoaNgBzAF1uuCNgM37BmBHxybhp+QW+XAFhOAAmSQBhKExDRSVd6jpfbg1E-NCwiLgwa+ZgBwoRRsy1k8jycAARMhWq4IR5lGF0GE5FAqHBZuxsHRlFBZvZghx3H02GiuOhXp0FAB3FAvbAAHmhLgoAD4ABQASmOIgAzJIAKoUXSpSFknhQCEpRQUIKKKmFWwOMjJexCqVwa54opKHBQmGocnYSXyKgqHTuMUacRlIwAGVWWAUUDZZGJGzICTZEw5cHaLMQuC5luw4jFLrdORgHvISgstAYolOPLIXKAA)
@kettanaito kettanaito changed the title Fix example in README.md docs: fix example in README Aug 6, 2024
Copy link
Member

@kettanaito kettanaito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this, @jwbth 👏

@kettanaito kettanaito merged commit c0c3d5a into open-draft:main Aug 6, 2024
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.

2 participants