Skip to content

Add more type definitions#882

Merged
tedpatrick merged 3 commits into
pyscript:mainfrom
FabioRosado:fr/types
Oct 27, 2022
Merged

Add more type definitions#882
tedpatrick merged 3 commits into
pyscript:mainfrom
FabioRosado:fr/types

Conversation

@FabioRosado

Copy link
Copy Markdown
Contributor

I started adding some types in an effort to fix #834 but Jeff discovered the issue and fixed it 😄

This PR adds a bit of typing across the board - I'm still learning how to use the more advanced features of typescript, so there are some changes that I am unsure of 🤔

Also I'm not entirely sure if we should replace some/all of these any for unknown

@antocuni

Copy link
Copy Markdown
Contributor

ouch, sorry to stumble upon your feet, but note that in PR #881 I'm doing (yet another 😅) heavy refactoring which among the other things kills a lot of code, include some which was also touched by you.
In particular, the PyScript class becomes very thin, andBaseEvalElement is used only as a base class for PyRepl.
It might make more sense to wait for that PR to land and then rebase... sorry :(

@FabioRosado

Copy link
Copy Markdown
Contributor Author

ouch, sorry to stumble upon your feet, but note that in PR #881 I'm doing (yet another sweat_smile) heavy refactoring which among the other things kills a lot of code, include some which was also touched by you. In particular, the PyScript class becomes very thin, andBaseEvalElement is used only as a base class for PyRepl. It might make more sense to wait for that PR to land and then rebase... sorry :(

Haha no worries! I'll wait for that PR to be in and rebase on it 😄

@marimeireles marimeireles left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Types! 🤩

@FabioRosado

Copy link
Copy Markdown
Contributor Author

I'm waiting for #884 to get in before I rebase 😄

@antocuni

Copy link
Copy Markdown
Contributor

I'm waiting for #884 to get in before I rebase smile

yes, after #884 I don't have any major refactoring planned :)

@fpliger

fpliger commented Oct 25, 2022

Copy link
Copy Markdown
Contributor

Nice PR! Thanks @FabioRosado

yes, after #884 I don't have any major refactoring planned :)

.... yet 😆

@madhur-tandon

Copy link
Copy Markdown
Contributor

@FabioRosado this should be rebased now since #884 is merged now 😅

@madhur-tandon madhur-tandon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rebase required 😅

@madhur-tandon madhur-tandon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@FabioRosado Yours to merge when the tests pass :)

@FabioRosado

Copy link
Copy Markdown
Contributor Author

Thanks @madhur-tandon I can't merge it though 😄

Just ran npm run lint and noticed some more types missing, I'll probably will open a follow up PR with them once I'm done unless this PR is still open then I will push here

@madhur-tandon

Copy link
Copy Markdown
Contributor

I'll probably will open a follow up PR with them once I'm done unless this PR is still open then I will push here

Whenever you are ready 💯

@fpliger

fpliger commented Oct 27, 2022

Copy link
Copy Markdown
Contributor

Alt Text

@@ -1,4 +1,4 @@
import { addClasses, htmlDecode, ensureUniqueId } from '../utils';

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@antocuni just checking, should pytitle call ensureUniqueId as well?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think that py-title should die in flames 😅.
Looking at the code I think it should because it's indeed using this.id.
But on the other hand, I don't think that the id is used for anything useful, so we could just avoid using it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Haha removing things is always fun!

Awesome I just wanted to be sure that I didn't removed something that we would use in the future 😀

@FabioRosado

Copy link
Copy Markdown
Contributor Author

There are still about 71 warnings but a lot of them are coming from pyodide since most of the methods are typed upstream as any, but I think for now this is good 😁

@tedpatrick tedpatrick merged commit 1c53d91 into pyscript:main Oct 27, 2022
@tedpatrick

Copy link
Copy Markdown
Contributor

Awesome work

@FabioRosado FabioRosado deleted the fr/types branch October 28, 2022 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

pre-commit CI is failing

6 participants