I have defined a custom path as answered in this thread.
"baseUrl": ".",
"paths": {
"@library/*": [
"./src/myFolder/*"
],
}
From this module, I export an Enum.
export enum ENUM {
ONE = "one"
}
When trying to use it with the custom path, I get
Module not found: Can't resolve @path/I/imported/from in /path/to/src
No problem if imported directly with '../relative/path'
Here is a link to minimal project showing the problem. (Edit: I changed the code to stop using create-react-app, an error occur when the localhost:3400 is visited)
I first got this problem in a node project with express.
I guess that the problem comes from the fact that typescript types are not included in the compiled js and thus the value present in the enum is not present. It still seems strange that there is no warning about the fact that this "one" value might not be included.
My question is what would be the best approach to use custom path and exported enums ?