tatethurston / nextjs-routes

Type safe routing for Next.js
MIT License
571 stars 23 forks source link

Add option for same pathname but new hash #128

Closed sitch closed 1 year ago

sitch commented 1 year ago

Currently, these won't type properly if you wanted the equivalent of href="#some-id"

const id = "some-id"
<Link
  href={`${id}`}
/>

or

<Link
  href={{
    hash: id
  }}
/>

Should just need to union a hash only type:

type Hash = { hash: string }

export interface LinkProps ... {
  // Union `Hash` here
  href: Route | StaticRoute | Query | Hash
  ...
}
tatethurston commented 1 year ago

@sitch Thanks for reporting this.

sitch commented 1 year ago

:zap: fast! Thanks