Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebuild API as TS #5

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Rebuild API as TS #5

wants to merge 4 commits into from

Conversation

ctsstc
Copy link
Member

@ctsstc ctsstc commented Aug 11, 2023

This checks out v1.05 before the fern changes were added, those may need to be removed or reverted.

This creates the API utilizing TS and then includes the TS as part of the TSC build pipeline.

When running TSC I was getting a type error from the api.

TSC was throwing an error about these via this code:

.api/apis/edenai/types.ts

export type TextAnonymizationCreateResponse200 = FromSchema<
  (typeof schemas.TextAnonymizationCreate.response)['200']
>;

My IDE was not displaying these issues until I switched the 5.1.6 TS engine from VSCode to the project's save version (5.1.6), then they started highlighting in the IDE.

Oddly the types file was affected by the definitions from the schemas file.

I'm not sure if this will fix any issues, but it's worth a try. Maybe this is why the typing wasn't working before? I wonder if it's an issue in the Open API spec or something that needs to be addressed in the api library?¿ 🤔

PS: We should probably rimraf the build directory [dist] before we build it out every time, so we guarantee a clean slate.

Edit: it doesn't seem that the .api folder is being included into the build as I would expect 😕 Maybe this is because it's seen as an NPM package. I wonder if the consumer knows to include that or how it resolves it. So maybe it does need to be common JS instead, or the consumer needs to explicitly add it to it's TS Config build pipeline.

This file is far too large and it will likely break your IDE if you try to view differences. Working in it is laggy for me as well D;
TSC was throwing an error about these via this code:

`.api/apis/edenai/types.ts`
```
export type TextAnonymizationCreateResponse200 = FromSchema<
  (typeof schemas.TextAnonymizationCreate.response)['200']
>;
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant