-
Notifications
You must be signed in to change notification settings - Fork 16
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
Const enum pitfalls... #6
Comments
sooo, since this is a JS codebase, changing to regular the question becomes if i ever want to migrate to TS if this change would prevent inlining, which i want to retain. i guess this is the answer: the build step they link to is in a Gulpfile, so will need to be different for a Rollup/TS setup, but should be straightforward with something like https://www.npmjs.com/package/@rollup/plugin-replace |
@leeoniya Thanks for your comments. I should have explained my issue in more detail and maybe you would have a suggestion to fix it. But I did not get a chance to create an MRE before. I think I have something now that should be pretty easy to reproduce. Let's say I create a simple React app that uses Typescript using: npx create-react-app my-app --template typescript Now I want to use your excellent npm i udsv Then I add the following two simple lines near the top of import { SchemaColumnType } from 'udsv';
const foo = SchemaColumnType.Number; This produces the following TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided. So, ...
isolatedModules": false
... Now I get the following error message(s): udsv__WEBPACK_IMPORTED_MODULE_3__.SchemaColumnType is undefined
...
export 'SchemaColumnType' (imported as 'SchemaColumnType') was not found in 'udsv' (possible exports: inferSchema, initParser) Any thoughts? |
Well phooey. Enums inside |
can you check if the latest commit fixes it? update your dependency in
then run |
Thanks for the update, @leeoniya. However, unfortunately, I am getting the same error message (I tried the same update in my own local copy earlier and it did not work). I am fairly convinced after reading this that having the |
A few other discussions that you might find useful in this context: |
Use of
const enum
in uDSV.d.ts is problematic as described here. Please consider replacing it.The text was updated successfully, but these errors were encountered: