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

fix: type import rewrite #701

Merged
merged 2 commits into from
Oct 14, 2019
Merged

fix: type import rewrite #701

merged 2 commits into from
Oct 14, 2019

Conversation

XVincentX
Copy link
Contributor

@XVincentX XVincentX commented Oct 14, 2019

This is kind of a nasty TS to JS bug I found while trying to use Prism for its hosted version

Fundamentally given that it is a monorepo when generating the types for the current project the references points to the source code:

image

It goes without saying that such path does not exist in the published package, since that is instead found in @stoplight/prism-core package.

If you're using JavaScript, you won't even notice this bug. However, if you're using TypeScript and the http package, you'll notice some functions will return any instead of the correct interface (because TypeScript can't find the types, it will assume any).

This PR will use ttypescript project (a declarative wrapper for the TS compiler API) and adding a dropbox developed plugin that will rewrite the generated files path correctly

image

@XVincentX XVincentX marked this pull request as ready for review October 14, 2019 13:18
Copy link
Contributor

@karol-maciaszek karol-maciaszek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

"tsconfig-paths": "^3.8.0",
"ttypescript": "^1.5.7",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope we'll get rid of it when typescript starts supporting plugins via config.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not happening anytime soon unfortunately :(

@XVincentX XVincentX merged commit 69ebcd4 into master Oct 14, 2019
@XVincentX XVincentX deleted the feat/transform branch October 14, 2019 14:19
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.

None yet

2 participants