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

Update csstype from version 2 to version 3 #2829

Merged
merged 1 commit into from
Nov 14, 2020

Conversation

bz2
Copy link
Contributor

@bz2 bz2 commented Nov 13, 2020

Improved typing, and smaller type file with fewer internals exposed.

There are changes to the re-exported types but this feature exposing csstype has only just been released in preact. (#1797)

Expose TLength and TTime generics, and adapt length only to accept numbers of any kind, to match the 'px' appending logic in preact.

Version 3 differences.

Now sure how type definitions should be tested ideally?

Have tested locally, including using tsuquyomi for completions (which is the reason for the & {} hack).

style completions

Have also replaced the usage in one of my projects, which was using version 3 before:

-export type {Properties as CSSProperties} from 'csstype';
-
+export type CSSProperties = preact.JSX.CSSProperties<string | 0>;

Which works fine with my (limited) use of the style attribute.

@coveralls
Copy link

coveralls commented Nov 13, 2020

Coverage Status

Coverage remained the same at 100.0% when pulling ced60c6 on bz2:csstype_3 into cdb709e on preactjs:master.

Improved typing, and smaller type file with fewer internals exposed.

There are changes to the re-exported types but this feature exposing
csstype has only just been released in preact.

Expose TLength and TTime generics, and adapt length only to accept
numbers of any kind, to match the 'px' appending logic in preact.
Copy link
Member

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

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

Sweet! The only way we've found to test TS types is to add some code using a particular feature to one of our .ts files in our test suite and compile them. If they throw, something is off and if they don't we assume that everything is fine. I'm good with merging this PR as is though 👍

Thank you again so much for your contribution 🙌

@marvinhagemeister marvinhagemeister merged commit 3898945 into preactjs:master Nov 14, 2020
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.

3 participants