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

Property '_' does not exist on type 'HtmlFormTag' #530

Open
warcayac opened this issue Mar 31, 2024 · 0 comments
Open

Property '_' does not exist on type 'HtmlFormTag' #530

warcayac opened this issue Mar 31, 2024 · 0 comments

Comments

@warcayac
Copy link

I have a backend server with TSX, when using "_" attribute in any component of my app I always get an error message similar to this:

Property '_' does not exist on type 'HtmlFormTag'

For example this code:

export function HSversion({ path }: TProps) {
  return (
    <Layout>
      <>
        <form 
          hx-encoding='multipart/form-data' 
          hx-post={path}
          _='on htmx:xhr:progress(loaded, total) set #progress.value to (loaded/total)*100'
          style="margin-top: 1em;"
        >
          <input type='file' name='file' accept={fileExts}/>
          <p/>
          <button>Upload</button>
          <progress id='progress' value='0' max='100'></progress>
        </form>
      </>
    </Layout>
  )
}

This is its error:

Type '{ children: Element[]; "hx-encoding": string; "hx-post": string; _: string; style: string; }' is not assignable to type 'HtmlFormTag'.
  Property '_' does not exist on type 'HtmlFormTag'.ts(2322)

I created global.d.ts file in app root, and tried with this content:

interface HTMLElement {
  _?: string;
}

or this content

declare global {
  namespace JSX {
    interface IntrinsicElements {
      '_'?: {
        _: string;
      };
    }
  }
}

it seems not to work, how to fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant