-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: improve event handler types (#816)
Before this change the `flagsChanged` prop on `EventDetails` was of type unknown for all event types, and a cast was needed. After this change, `flagsChanged` is ONLY defined on `ProviderEvents.ConfigurationChanged`, where it should be, as (`string[] | undefined`) . In other words: ```typescript client.addHandler(ProviderEvents.Ready, (details) => { expect(details?.flagsChanged?.length).toEqual(1); // does not compile }); ``` ```typescript client.addHandler(ProviderEvents.ConfigurationChanged, (details) => { expect(details?.flagsChanged?.length).toEqual(1); // DOES compile }); ``` Additionally, `flagsChanged` does not autocomplete for events handlers other than `ProviderEvents.ConfigurationChanged`. Signed-off-by: Todd Baert <[email protected]>
- Loading branch information
Showing
7 changed files
with
73 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters