-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
feat(parser): generate enums into their own file #358
Conversation
🦋 Changeset detectedLatest commit: a786c22 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #358 +/- ##
==========================================
- Coverage 84.51% 84.16% -0.35%
==========================================
Files 73 73
Lines 4765 4813 +48
Branches 548 549 +1
==========================================
+ Hits 4027 4051 +24
- Misses 737 761 +24
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
/** | ||
* This is a simple enum with strings | ||
*/ | ||
export type foo_bar_enum_ = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is up with these?
* These are the HTTP error code enums | ||
*/ | ||
export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; | ||
|
||
/** | ||
* This is a model with one enum with escaped name | ||
*/ | ||
export type ModelWithEnumWithHyphen = { | ||
'foo-bar-baz-qux'?: '3.0'; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whats going on here? why is it generate separately
FOO = 'foo', | ||
BAR = 'bar', | ||
} | ||
export type foo = 'Bar'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are these being generated now?
@@ -31,6 +32,11 @@ export class TypeScriptFile { | |||
this._imports = [...this._imports, compiler.import.named(...params)]; | |||
} | |||
|
|||
public setPath(path: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we pass the path in the class contructor (same with a header)? Its probably cleaner than doing this. And they can be optional
|
||
```js | ||
import { Enum, DefaultService } from 'client' // [!code --] | ||
import { Enum } from 'client/enums.gen.ts' // [!code ++] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably work on renaming all files to .gen.ts for consistency
No description provided.