fix(shell): fix api

This commit is contained in:
Il Harper 2024-03-06 12:20:47 +08:00
parent fed0b39b27
commit 6b3ea9e209
No known key found for this signature in database
GPG Key ID: 4B71FCA698E7E8EC

View File

@ -36,15 +36,16 @@ const buildNotimpl = (name: string) => {
[notimplSym]: boolean
}
)[notimplSym] = true
return fn
}
const handler: ProxyHandler<Api> = {
get: function (target, name) {
return typeof name === 'symbol' ||
Object.prototype.hasOwnProperty.call(target, name)
get: (target, name) =>
typeof name === 'symbol' ||
Object.prototype.hasOwnProperty.call(target, name)
? target[name as keyof Methods]
: buildNotimpl(name)
},
: buildNotimpl(name),
}
export const api = new Proxy({} as Api, handler)