ts-nameof
ts-nameof copied to clipboard
Using with a create-react-app (v2) project
Any pointers on how it might be possible to use ts-nameof with a react project using create-react-app. That now uses babel for the typescript compilation so I'm unsure if it provides the configuration points necessary to set this up?
@rsuk no sorry! There just needs to be a way to inject a ts.TransformerFactory<ts.SourceFile>
object (the export of this library) into create-react-app and it would work. I haven't found anything yet, but I'll look again soon.
any update on this? Thanks
@refex create-react-app is very locked down, so I'm not sure there's a way to inject the transformer into it. It might be possible with https://github.com/timarney/react-app-rewired in case anyone has time to look into it (I do not at the moment).
thanks for the hint
ts-nameof.macro
babel-plugin-macros
import nameof from 'ts-nameof.macro';
ts-nameof.macro babel-plugin-macros
import nameof from 'ts-nameof.macro';
can you provide more details for beginners? :-)
It's explained here:
https://stackoverflow.com/a/67670187/7027224