Code Monkey home page Code Monkey logo

Comments (6)

leeoniya avatar leeoniya commented on May 23, 2024 1

can you check if the latest commit fixes it?

update your dependency in package.json with the github commit link:

"udsv": "leeoniya/uDSV#0c191e8a80e7b0d78bfd0bf6ec37dc576deefbde

then run npm install again

from udsv.

udsv-user avatar udsv-user commented on May 23, 2024 1

A few other discussions that you might find useful in this context:

from udsv.

leeoniya avatar leeoniya commented on May 23, 2024

sooo, since this is a JS codebase, changing to regular enum in the .d.ts file is inconsequential.

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:

image

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

from udsv.

udsv-user avatar udsv-user commented on May 23, 2024

@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 udsv library with it so I add it:

npm i udsv

Then I add the following two simple lines near the top of App.tsx:

import { SchemaColumnType } from 'udsv';
const foo = SchemaColumnType.Number;

This produces the following error warning on the second line above:

TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.

So, const enums cannot be used with isolatedModules. Fine, so I will disable isolatedModules in tsconfig.json which eliminates this warning but does not solve the problem.

    ...
    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?

from udsv.

udsv-user avatar udsv-user commented on May 23, 2024

Well phooey. Enums inside .d.ts files are of no use in such cases (as you already pointed out in your comments as this is a JS codebase).

from udsv.

udsv-user avatar udsv-user commented on May 23, 2024

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 enum just in the .d.ts file will not work. So, please don't waste any more of your (valuable) time on this issue. Someday, if you decide to switch to Typescript, I will drop by and help out.

from udsv.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.