Git Product home page Git Product logo

Comments (7)

DigiPascal avatar DigiPascal commented on May 30, 2024

Hi @threeaccents,

"I ended up declaring a dummy .d.ts file" > Can you describe what you did ?
I have the same issue and I have no clue how to fix this...

Thanks

from grapesjs-react.

threeaccents avatar threeaccents commented on May 30, 2024

@DigiPascal create a file named grapejs.d.ts inside of it add the following:

declare module 'grapesjs-react';

Then in what ever file you're gonna use the grapejs component add at the top:
/// <reference path="path/to/grape.d.ts" />

And then you should be good to go. You won't get any types while using the component but at least the compiler won't complain.

from grapesjs-react.

thanhtunguet avatar thanhtunguet commented on May 30, 2024

Hi all,
I am using rollup to compile this package but I don't know how to config rollup to generate d.ts file, can anyone help me?

from grapesjs-react.

threeaccents avatar threeaccents commented on May 30, 2024

I was checking out the code more and I noticed the declaration file is already being generated in the dist folder as grapesjs-react.d.ts so I think all you need to do is include it in the package.json

{
   ....
  "main": "./dist/grapesjs-react.cjs.js",
  "module": "./dist/grapesjs-react.js",
  "types": "./dist/grapesjs-react.d.ts",
}

Here is a PR #30

from grapesjs-react.

threeaccents avatar threeaccents commented on May 30, 2024

@DigiPascal If you want proper types until the PR is merged just go into your node_modules/grapesjs-react/package.json

and add
"types": "./dist/grapesjs-react.d.ts",

You can then remove the dummy declarations file I had recommended earlier. Will probably need to restart the server to see it work and your code editor as well.

from grapesjs-react.

thanhtunguet avatar thanhtunguet commented on May 30, 2024

@DigiPascal If you want proper types until the PR is merged just go into your node_modules/grapesjs-react/package.json

and add
"types": "./dist/grapesjs-react.d.ts",

You can then remove the dummy declarations file I had recommended earlier. Will probably need to restart the server to see it work and your code editor as well.

Thank you. I have updated package.json file and then published v3.0.4. Please check it out

from grapesjs-react.

DigiPascal avatar DigiPascal commented on May 30, 2024

Tried it from scratch and works like a charm! :-)

Thanks @threeaccents and @thanhtunguet

from grapesjs-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.