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

[ts] Use CSSStyleDeclaration for CSS property list #2869

Merged
merged 9 commits into from
Dec 21, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions config/copy-csstype.js

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"build:test-utils": "microbundle build --raw --cwd test-utils",
"build:compat": "microbundle build --raw --cwd compat --globals 'preact/hooks=preactHooks'",
"build:jsx": "microbundle build --raw --cwd jsx-runtime",
"postbuild": "node ./config/node-13-exports.js && node ./config/copy-csstype.js",
"postbuild": "node ./config/node-13-exports.js",
"dev": "microbundle watch --raw --format cjs",
"dev:hooks": "microbundle watch --raw --format cjs --cwd hooks",
"dev:compat": "microbundle watch --raw --format cjs --cwd compat --globals 'preact/hooks=preactHooks'",
Expand Down
18 changes: 5 additions & 13 deletions src/jsx.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Users who only use Preact for SSR might not specify "dom" in their lib in tsconfig.json
/// <reference lib="dom" />
import * as CSS from './jsx-csstype';

type Defaultize<Props, Defaults> =
// Distribute over unions
Expand Down Expand Up @@ -33,18 +32,11 @@ export namespace JSXInternal {
children: any;
}

interface CSSProperties<
TLength = (string & {}) | number,
TTime = string & {}
> extends CSS.Properties<TLength, TTime> {
/**
* The index signature was removed to enable closed typing for style
* using CSSType. You're able to use type assertion or module augmentation
* to add properties or an index signature of your own.
*
* For examples and more information, visit:
* https://github.com/frenic/csstype#what-should-i-do-when-i-get-type-errors
*/
type DOMCSSProperties = {
[key in keyof CSSStyleDeclaration]?: CSSStyleDeclaration[key] extends string ? (CSSStyleDeclaration[key] | number | null | undefined) : never;
};
interface CSSProperties extends DOMCSSProperties {
[key: string]: string | number | null | undefined;
}

interface SVGAttributes<Target extends EventTarget = SVGElement>
Expand Down