globalbrain / sefirot

Global Brain Design System.
https://sefirot.globalbrains.com
MIT License
151 stars 12 forks source link

fix(url): change cast callback value type to any #414

Closed kiaking closed 9 months ago

kiaking commented 9 months ago

The value could be for example array, if the stored object is array. So, I guess it makes sense to make this any 👀

Or should we scope this to something like string or object or array?

useUrlQuerySync(options, {
  casts: {
    // It is indeed array but type error.
    // No `map`, since value is typed as `string`.
    'tags': (v) => v.map(Number),
  }
})
netlify[bot] commented 9 months ago

Deploy Preview for sefirot-story ready!

Name Link
Latest commit bd9fee5a37a7312b864c42b2f524ee7037d44fa8
Latest deploy log https://app.netlify.com/sites/sefirot-story/deploys/657c0a41c505070008cfcd3a
Deploy Preview https://deploy-preview-414--sefirot-story.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] commented 9 months ago

Deploy Preview for sefirot-docs ready!

Name Link
Latest commit bd9fee5a37a7312b864c42b2f524ee7037d44fa8
Latest deploy log https://app.netlify.com/sites/sefirot-docs/deploys/657c0a41172fda0008d6257e
Deploy Preview https://deploy-preview-414--sefirot-docs.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

brc-dd commented 9 months ago

Ah yeah. I forgot about arrays and objects. The end value is always string. Like even if you have something like ?foo[0]=1 it will be { foo: ['1'] } or maybe in case of objects -> { foo: { bar: { baz: 'always string' } } }. Not sure though if we can represent this with anything better than any 👀

(maybe string | any[] | Record<string, any>)

kiaking commented 9 months ago

Yeah... well it's url. It must be any ðŸĪŠ