sam-goodwin / eventual

Build scalable and durable micro-services with APIs, Messaging and Workflows
https://docs.eventual.ai
MIT License
174 stars 4 forks source link

Infer creates non-portable types because of type-fest #392

Closed sam-goodwin closed 1 year ago

sam-goodwin commented 1 year ago

If I create an entity and Infer its type, the type is not exportable because of type-fest

const Hello = entity("Hello", {
  ...
});

type Hello = Infer<typeof Hello>

if i use this in a command, i can't export it

export const helloCommand = command("hello", async (hello: Hello) => {
 ///
});
The inferred type of 'helloCommand' cannot be named without a reference to '.pnpm/type-fest@0.21.3/node_modules/type-fest'. This is likely not portable. A type annotation is necessary.ts(2742)
The inferred type of 'helloCommand' cannot be named without a reference to '.pnpm/type-fest@0.21.3/node_modules/type-fest/source/simplify.js'. This is likely not portable. A type annotation is necessary.ts(2742)
sam-goodwin commented 1 year ago

Regression from https://github.com/functionless/eventual/pull/389

sam-goodwin commented 1 year ago

Wow, so this can be fixed with an interface!

interface Hello extends Infer<typeof Hello> {}