You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most plugins expose configuration options that allow you to rename many of the generated symbols. If you need even more control, use the `getName()` hook.
667
+
668
+
#### Example: Enum naming
669
+
670
+
By default, generated enums use the same name for both the type and the runtime value.
671
+
672
+
::: code-group
673
+
674
+
```ts [example]
675
+
exportconstFlags= {
676
+
ALPHA:'alpha',
677
+
BETA:'beta',
678
+
} as const;
679
+
680
+
exporttypeFlags= (typeofFlags)[keyoftypeofFlags];
681
+
```
682
+
683
+
```js [config]
684
+
exportdefault {
685
+
input:'hey-api/backend', // sign up at app.heyapi.dev
686
+
output:'src/client',
687
+
plugins: [
688
+
{
689
+
enums:'javascript',
690
+
name:'@hey-api/typescript',
691
+
},
692
+
],
693
+
};
694
+
```
695
+
696
+
:::
697
+
698
+
While this code works perfectly fine due to TypeScript's declaration merging, let's say we want to use a different name for the type. We can accomplish this with the `getName()` hook.
0 commit comments