Skip to content

Commit

Permalink
Improve typing
Browse files Browse the repository at this point in the history
  • Loading branch information
hbendev committed Jun 23, 2023
1 parent bd9ff40 commit 82ecc34
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/docs/src/routes/api/qwik/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@
"id": "cssproperties"
}
],
"kind": "TypeAlias",
"content": "```typescript\nexport type CSSProperties = CSS.Properties<string | number> & Record<string, string | number | undefined>;\n```",
"kind": "Interface",
"content": "```typescript\nexport interface CSSProperties extends CSS.Properties<string | number>, CSS.PropertiesHyphen<string | number> \n```\n**Extends:** CSS.Properties&lt;string \\| number&gt;, CSS.PropertiesHyphen&lt;string \\| number&gt;",
"editUrl": "https://github.com/BuilderIO/qwik/tree/main/packages/qwik/src/core/render/jsx/types/jsx-generated.ts",
"mdFile": "qwik.cssproperties.md"
},
Expand Down
5 changes: 3 additions & 2 deletions packages/docs/src/routes/api/qwik/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -461,10 +461,11 @@ createContextId: <STATE = unknown>(name: string) => ContextId<STATE>;
## CSSProperties

```typescript
export type CSSProperties = CSS.Properties<string | number> &
Record<string, string | number | undefined>;
export interface CSSProperties extends CSS.Properties<string | number>, CSS.PropertiesHyphen<string | number>
```
**Extends:** CSS.Properties&lt;string \| number&gt;, CSS.PropertiesHyphen&lt;string \| number&gt;
[Edit this section](https://github.com/BuilderIO/qwik/tree/main/packages/qwik/src/core/render/jsx/types/jsx-generated.ts)
## DOMAttributes
Expand Down
4 changes: 3 additions & 1 deletion packages/qwik/src/core/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ export interface CorePlatform {
export const createContextId: <STATE = unknown>(name: string) => ContextId<STATE>;

// @public (undocumented)
export type CSSProperties = CSS_2.Properties<string | number> & Record<string, string | number | undefined>;
export interface CSSProperties extends CSS_2.Properties<string | number>, CSS_2.PropertiesHyphen<string | number> {
[v: `--${string}`]: string | number | undefined;
}

// @internal (undocumented)
export const _deserializeData: (data: string, element?: unknown) => any;
Expand Down
15 changes: 13 additions & 2 deletions packages/qwik/src/core/render/jsx/types/jsx-generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,19 @@ export type Numberish = number | `${number}`;
/**
* @public
*/
export type CSSProperties = CSS.Properties<string | number> &
Record<string, string | number | undefined>;
export interface CSSProperties
extends CSS.Properties<string | number>,
CSS.PropertiesHyphen<string | number> {
/**
* 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
*/
[v: `--${string}`]: string | number | undefined;
}

/**
* @public
Expand Down

0 comments on commit 82ecc34

Please sign in to comment.