diff --git a/.changeset/chatty-timers-itch.md b/.changeset/chatty-timers-itch.md new file mode 100644 index 0000000..053e85a --- /dev/null +++ b/.changeset/chatty-timers-itch.md @@ -0,0 +1,5 @@ +--- +"@teiler/core": patch +--- + +Fix `css` helper function types diff --git a/packages/core/src/constructor.ts b/packages/core/src/constructor.ts index efdada6..bcd7f00 100644 --- a/packages/core/src/constructor.ts +++ b/packages/core/src/constructor.ts @@ -91,8 +91,9 @@ function keyframes(strings: ReadonlyArray, ...properties: Raw[]): StyleD } } -function css(strings: ReadonlyArray, ...properties: Exclude, Expression>[]): CSS { - const style: Style = [Array.from(strings), properties] +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function css(strings: ReadonlyArray, ...properties: Exclude, Expression>[]): CSS { + const style: Style = [Array.from(strings), properties] const styles = [style] const id = styles.reduce((acc, [strings]) => acc + strings.join(''), '') return { styles: styles, id: 't' + hash(id), __css__: true } diff --git a/packages/core/src/pattern.ts b/packages/core/src/pattern.ts index 543e9b6..bbe473e 100644 --- a/packages/core/src/pattern.ts +++ b/packages/core/src/pattern.ts @@ -4,10 +4,8 @@ import type { HTMLElements } from './tags' import tags from './tags' import hash from './hash' -type PropertiesWithPattern = Properties | Pattern - -type Pattern = { - styles: Style[] +type Pattern = { + styles: Array>, tag: Target id: string __pattern__: true @@ -17,14 +15,14 @@ type ExtendCallback = (string: Re type Constructor = { (pattern: Pattern): ExtendCallback - (string: ReadonlyArray, ...properties: PropertiesWithPattern[]): Pattern + (string: ReadonlyArray, ...properties: Properties[]): Pattern } type Infer = Component extends Pattern ? P & Props : Props const construct = (tag: Target) => { function create(stringOrPattern: Pattern): ExtendCallback - function create(stringOrPattern: ReadonlyArray, ...properties: PropertiesWithPattern[]): Pattern + function create(stringOrPattern: ReadonlyArray, ...properties: Properties[]): Pattern function create(stringOrPattern: Pattern | ReadonlyArray, ...properties: Properties[]): Pattern | ExtendCallback { if ('__pattern__' in stringOrPattern) { return (strings: ReadonlyArray, ...properties: Properties>[]) => {