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

Narrow deserialize and improve strictness #3571

Merged
merged 3 commits into from
Sep 2, 2022

Conversation

vidartf
Copy link
Member

@vidartf vidartf commented Aug 26, 2022

Some of the easier to approve changes from #3570:

This increases the typescript strictness, and makes the exceptions that we need explicit (this will also opt us in to any future TS strictness checks by default). In addition to that, the following changes were made:

  • Fix assumptions about all caught errors being instances of Error. With strict checks, TS insists that these are unknown.
  • Further narrow typing of output from _deserialize from Tweak some typings #3554: After deserialization, we know we have a dict of something, but have no idea about what is in it, since deserializers can return anything.

Be more explicit about the fact that we don't know the output of deserialized output
This also makes it explicit which exceptions from full strictness that we rely on:
- noImplicitThis: Mostly in backbone patch
- strictPropertyInitialization: a bunch of properties initialized during backbone init calls is not covered correctly for this strict check
- strictFunctionTypes: The ISerializer interface makes all the arguments optional to allow simpler definitions (`deserializer: (value: any): unknown  => { ... }`). However, this does cause `unpack_models` to be typed
@github-actions
Copy link

Binder 👈 Launch a binder notebook on branch vidartf/ipywidgets/narrow-deserialize

@vidartf vidartf changed the title Narrow deserialize Narrow deserialize and improve strictness Aug 26, 2022
@jasongrout jasongrout added this to the 8.0.x milestone Aug 30, 2022
@jasongrout jasongrout merged commit 6ddc642 into jupyter-widgets:master Sep 2, 2022
@vidartf vidartf deleted the narrow-deserialize branch September 13, 2022 16:39
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.

None yet

2 participants