tryretool / retoolrpc

MIT License
6 stars 5 forks source link

Bug(TypeScript): optional properties inferred as omnipresent #27

Closed KATT closed 8 months ago

KATT commented 8 months ago

Optional properties are inferred as omnipresent

rpc.register({
  name: 'helloWorld',
  arguments: {
    name: { type: 'string', required: false },
  },
  implementation: async (args, context) => {
    args.name;
    //  ❌  ^? this should be undefined | string
  },
});

Currently it is inferred as "string"