Skip to content

<A> component rejects children prop — type error in 0.17.0-next.3 #562

@tmvc03

Description

@tmvc03

Describe the bug

The <A> component's type AnchorProps does not include children, so passing any content between the tags produces a TypeScript error. Since <A> renders an <a> element, children should be allowed (and are required in practice for the component to be useful).

Error

Type '{ children: string; href: string; }' is not assignable to type 'IntrinsicAttributes & AnchorProps'.
  Property 'children' does not exist on type 'IntrinsicAttributes & AnchorProps'. ts(2322)

Your Example Website or App

https://stackblitz.com/edit/solidjs-templates-lwudg9vg

Steps to Reproduce the Bug or Issue

import { A } from "@solidjs/router";
 
export default function Nav() {
  return (
    <nav>
      <A href="/">home</A>
      <A href="/search">search</A>
    </nav>
  );
}

Expected behavior

<A> should accept children (text, elements, or any JSX.Element), matching the behavior of the underlying <a> element and prior versions of the router.

Screenshots or Videos

No response

Platform

{
  "devDependencies": {
    "typescript": "^5.1.3",
    "vite": "^8.0.0",
    "vite-plugin-solid": "3.0.0-next.4"
  },
  "dependencies": {
    "@solidjs/router": "^0.17.0-next.3",
    "@solidjs/web": "2.0.0-beta.10",
    "solid-js": "2.0.0-beta.10"
  }
}
  • @solidjs/router: 0.17.0-next.3
  • solid-js: 2.0.0-beta.10
  • TypeScript: ^5.1.3

Additional context

No response

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions