Skip to content

Commit 672b575

Browse files
authored
fix: make custom properties optional in created types (#69) (#70)
* fix: make custom properties optional in created types (#69) * test: add custom property example to tests
1 parent 4fc1c15 commit 672b575

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ function render(parsed: Parsed): string {
127127

128128
if (Array.from(properties).length > 0) {
129129
const propertyEntries = Array.from(properties)
130-
.map((prop) => `'${prop}': string`)
130+
.map((prop) => `'${prop}'?: string`)
131131
.join(', ')
132132
interfaceDefinition += ` style?: { ${propertyEntries} } & React.CSSProperties\n`
133133
}

test/button.mist.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
button {
2+
--highlightColor: rebeccapurple;
23
padding: 0.5rem 1rem;
34
border-radius: 0.25rem;
45
font-weight: bold;

test/mist.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
interface Mist_button extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLButtonElement>, HTMLButtonElement> {
22
'data-variant'?: 'primary' | 'secondary'
3+
style?: { '--highlightColor'?: string } & React.CSSProperties
34
}
45

56
interface Mist_div extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {

0 commit comments

Comments
 (0)