Giter VIP home page Giter VIP logo

Comments (8)

laurengarcia avatar laurengarcia commented on May 27, 2024 2

Hi @oznekenzo I wish I could guarantee for sure that the index.d.ts you added worked w/ TS. Simple definitions file like this has worked for me in the past to support TS on smaller packages with very simple interfaces. I tried adding it to my project yesterday but ended up giving up -- my react app was "ejected" from create-react-app and has a very complex webpack configuration (ugh), and unfortunately I couldnt figure out how to splice 3box-comments-react into it. It was difficult to debug because the 3box index.js is a very large file(!) and my code editor could barely even display, let alone ctrl-f or scroll thru to see what might be the issue.

Sorry I couldnt be more help on this front but I'm out of time.
Might circle back on this later (in a few months).

from 3box-comments-react.

oed avatar oed commented on May 27, 2024

There is no typescript support since this is not a typescript project :)
Feel free to contribute types to http://definitelytyped.org/ !

from 3box-comments-react.

laurengarcia avatar laurengarcia commented on May 27, 2024

I could shim in a solution for myself that fixes my own immediate problem, but it will result in duplicated effort in your ecosystem... on the other hand if i submit the solution to definitelytyped, i'm on the hook to maintain it and if its not my primary project then its going to fall out of date and probably result in alot of unhappy customers on your side.

(...I also have no idea if the other person in your Discord having build trouble with TS was able to resolve it, and if it even had anything to do with Typescript in the first place or some other issue elsewhere in your pipes...)

Most of the dapps in cryptoland use Typescript from what i've seen.
This request will be a frequent and recurring theme :)

from 3box-comments-react.

oznekenzo avatar oznekenzo commented on May 27, 2024

Saw a lot of long winded tutorials on adding ts support, but seems its as simple as just adding the index.d.ts file - hoping this is the case.
This file has been added, would be great for @laurengarcia to test with the [email protected] npm beta release - once that's confirmed to work, will publish and can add support to our other components

from 3box-comments-react.

oznekenzo avatar oznekenzo commented on May 27, 2024

@laurengarcia thanks for the help on this one - closing

from 3box-comments-react.

oznekenzo avatar oznekenzo commented on May 27, 2024

We don't have TS support in the main 3box.js package at the moment, so perhaps ejecting your react app required you interface directly with 3box.js instead of though 3box-comments-react (I don't know whether you are depending on 3box elsewhere or if its coming in through the comments plugin). Is it just now a matter of providing the type interface for the 3box lib?

from 3box-comments-react.

laurengarcia avatar laurengarcia commented on May 27, 2024

My workaround is lazy-loading 3box.js from the 3box CDN and adding it to my react app on the fly in the browser. In other words, I'm side-stepping the "build" step, so i don't have to worry about 3box.js TS at this point, but it would be nice to have. The downside of this approach being that i dont get the nice UI from this pkg, but it works for what i need to do for now.

from 3box-comments-react.

laurengarcia avatar laurengarcia commented on May 27, 2024

Figured it out, just leaving a note for some other poor soul out there who may be using create-react-app in "ejected" mode (meaning all webpack and .tsconfig configs are unbundled so they can be customized):

You may need to set "allowSyntheticDefaultImports": true, in your .tsconfig file so it can consume and be backward-compatible with ES5 modules (like this one) that use module.exports (vs. ES6 import/export syntax).

from 3box-comments-react.

Related Issues (20)

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.