tryretool / retoolrpc

MIT License
6 stars 5 forks source link

Not sure why types aren't working, I might have done something wrong #20

Closed NOT-HAL9000 closed 9 months ago

NOT-HAL9000 commented 9 months ago
import { RetoolRPC } from "retoolrpc";
Could not find a declaration file for module 'retoolrpc'. '/[path]/node_modules/retoolrpc/dist/index.mjs' implicitly has an 'any' type.
  Try `npm i --save-dev @types/retoolrpc` if it exists or add a new declaration (.d.ts) file containing `declare module 'retoolrpc';`ts(7016)
rpc.register({
  name: "helloWorld",
  arguments: {
    name: { type: "string", description: "Your name", required: true },
  },
  implementation: async (args, context) => {
    return {
      message: `Hello ${args.name}`,
      context,
    };
  },
});
Parameter 'args' implicitly has an 'any' type.ts(7006)
Parameter 'context' implicitly has an 'any' type.ts(7006)

This is for when typescript is in strict mode. I am using this in a typescript project. I can't seem to get it working.

Retool RPC is a game changer and needs serious attention imo, it makes building retool native apps much easier without relying on building api infra to communicate with a backend.

NOT-HAL9000 commented 9 months ago

Was using NodeNext as moduleResolution in tsconfig instead of Node. Also changed module to CommonJS and it works.