google / intermock

Mocking library to create mock objects with fake data for TypeScript interfaces
https://google.github.io/intermock/
Apache License 2.0
1.14k stars 71 forks source link

Trying to mock APIGatewayProxyEvent in aws-lambda types causes unsupported primitive type 168 #12

Closed terlar closed 4 years ago

terlar commented 5 years ago

Hello this project looks interesting, I was trying to use it for generating an APIGatewayProxyEvent.

However I get the following error:

$ intermock --files node_modules/@types/aws-lambda/index.d.ts --interfaces APIGatewayProxyEvent
Unsupported Primitive type 168

The source file is located here: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/aws-lambda/index.d.ts#L79

I had a look at the type and couldn't figure out what the unsupported part is, it looks like most are the supported ones, but might have missed what is different due to the quite huge object.

Any ideas what 168 means?

kylebjordahl commented 4 years ago

Hey @terlar - I just ran across this today and did some digging; it comes from the typescript library itself, in the SyntaxKind enum.

Specifically, 168 is a TypeLiteral, ~which I believe is commonly a result of enums which are declared with const, i.e:~

It seems that intermock doesn't currently support type literals, but I have a use case for it, so I'll be looking into solving this in a fork.

edit: Probably related to #6 (doh!)

terlar commented 4 years ago

Thank you, then I will close this in favor of the other one.