type-fest icon indicating copy to clipboard operation
type-fest copied to clipboard

`JsonObject` not limit object keys type

Open Emiyaaaaa opened this issue 11 months ago • 1 comments

typescript: 5.1.6

type JsonObject not limit Object key type like symbol

const a = {[Symbol(1)]: 1}
function test(v: JsonObject) {}

// issue
test(a) // no ts error, should throw ts error
type b = typeof a extends JsonObject ? true : false // true, should be false

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • The funding will be given to active contributors.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar

Emiyaaaaa avatar Sep 05 '23 10:09 Emiyaaaaa

found this: https://github.com/microsoft/TypeScript/issues/53265 https://github.com/microsoft/TypeScript/issues/44794

have any way to fix it in type-fast?

Emiyaaaaa avatar Sep 06 '23 04:09 Emiyaaaaa