brillout / wildcard-api

Functions as API.
MIT License
368 stars 14 forks source link

Cannot find type declarations with typescript #49

Closed michie1 closed 4 years ago

michie1 commented 4 years ago

I try to use wildcard-api with typescript and tsc is erroring on a missing type declaration.

import wildcard from "@wildcard-api/server/express";

Cannot find module '@wildcard-api/server/express' or its corresponding type declarations.

Any ideas where I can find the types?

brillout commented 4 years ago

Hi @michie1

Wildcard doesn't have type declaration; would using any be ok for you?

You can however type your endpoint functions, as described in https://github.com/reframejs/wildcard-api#typescript

michie1 commented 4 years ago

Hello @brillout.

Thank you for the answer. I just wasn't sure I did something wrong or if they weren't there. I've created a file index.d.ts with

declare module "@wildcard-api/server";
declare module "@wildcard-api/server/express";
declare module "@wildcard-api/client";

in order to resolve the errors and that yields anys.

Sharing the types of the endpoints works wonderful. You can close this issue if you want.

brillout commented 4 years ago

:+1: Let me know if there is anything else.

Rom