nanojsx / nano

🎯 SSR first, lightweight 1kB JSX library.
http://nanojsx.io
MIT License
1.46k stars 38 forks source link

jsx typing problem #9

Closed c7h12 closed 3 years ago

c7h12 commented 3 years ago

I am using vscode, and the follow code

export const Article = ({ html }: { html: string }) => {
  return jsx`<div class="article-content">${html}</div>`;
};

results image in vscode.

The type defining of jsx accepts just one param named statics, can it be fixed?

https://github.com/nanojsx/nano/blob/18fd227302ee06db06736d520d5bef16a864fec0/src/htm/build.ts#L119

yandeu commented 3 years ago

Looks like this works. What do you think?

- export const build = function (statics: any) {
+ export const build = function (...statics: any) {
+   statics = statics.flat()
c7h12 commented 3 years ago

What about This?

export const build = function (statics: string[],...rest:any[]) {
  const fields = [0,...rest]