Skip to content

prefixed-nanoid@0.2.1

Latest

Choose a tag to compare

@github-actions github-actions released this 19 Mar 10:03
· 16 commits to main since this release

Patch Changes

  • 061199c: chore: fix InferId example in README.md

    InferId requires using as const in createPrefixedNanoIds():

    import { createPrefixedNanoIds } from 'prefixed-nanoid'
    
    import type { InferId } from 'prefixed-nanoid'
    
    const ids = createPrefixedNanoIds({
      project: { prefix: 'prj', len: 24 },
      user: { prefix: 'usr', len: 16 }
    } as const) // need to add `as const`
    
    type ProjectId = InferId<typeof ids, 'project'>
    type UserId = InferId<typeof ids, 'user'>
    type AnyId = InferId<typeof ids> // union of all configured ID types