brackets-viewer.js icon indicating copy to clipboard operation
brackets-viewer.js copied to clipboard

Unable to import types

Open NoahSurprenant opened this issue 1 year ago • 5 comments

In my typescript project I am having issues importing types such as the BracketsViewer. It appears that this was completed according to https://github.com/Drarig29/brackets-viewer.js/issues/27 but I am using version 1.6.2 and I am unable to import the types.

I am not much of a typescript guru but I believe that either the tsconfig.json needs declaration set to true and/or the package.json needs to have the types property set. I am willing to look into this issue and make a fix if problem is not between chair and keyboard.

For more context I am able to import BracketsManager like so:

import { BracketsManager } from 'brackets-manager/dist'

But I cannot import BracketsViewer, I have tried the following:

import { BracketsViewer } from 'brackets-viewer/dist';

and the following as mentioned in https://github.com/Drarig29/brackets-viewer.js/issues/27

import { BracketsViewer } from 'brackets-viewer';

I get the following error: TS2307: (TS) Cannot find module 'brackets-viewer' or its corresponding type declarations.

NoahSurprenant avatar May 11 '24 23:05 NoahSurprenant

Hello, have you find any solution?

atalayio avatar Aug 18 '24 11:08 atalayio

Did you install brackets-viewer?

Drarig29 avatar Aug 18 '24 13:08 Drarig29

Did you install brackets-viewer?

Yes I'm still same...

atalayio avatar Aug 18 '24 13:08 atalayio

What package manager are you using? And how are you importing the viewer?

Drarig29 avatar Aug 18 '24 13:08 Drarig29

What package manager are you using? And how are you importing the viewer?

Using yarn but I tried on npm too doesn't matter it's giving me to "that error.

import BracketsViewer from "brackets-viewer" //giving error

const BracketsViewer = require("brackets-viewer") // giving same error too

atalayio avatar Aug 18 '24 14:08 atalayio

I'm having the same issue, I'm also using npm, did you find any soluition @atalayio / @NoahSurprenant ? @Drarig29 is dead the repo I guess? are you accepting prs / contributions?

joaquinjsb avatar Sep 05 '25 22:09 joaquinjsb

I'm having the same issue, I'm also using npm, did you find any soluition @atalayio / @NoahSurprenant ? @Drarig29 is dead the repo I guess? are you accepting prs / contributions?

In my own project, I resorted to copying the types into their own file. But that is just a hack and ideally the types should be exported. I opened this PR https://github.com/Drarig29/brackets-viewer.js/pull/112 that I believe exports the type properly. But I am not a TypeScript expert nor am I a maintainer here.

NoahSurprenant avatar Sep 06 '25 02:09 NoahSurprenant

I'm having the same issue, I'm also using npm, did you find any soluition @atalayio / @NoahSurprenant ? @Drarig29 is dead the repo I guess? are you accepting prs / contributions?

In my own project, I resorted to copying the types into their own file. But that is just a hack and ideally the types should be exported. I opened this PR #112 that I believe exports the type properly. But I am not a TypeScript expert nor am I a maintainer here.

got it, let's see if dragrig has any feedback on it, thanks!

joaquinjsb avatar Sep 06 '25 12:09 joaquinjsb

Hey guys! Thanks @NoahSurprenant for your PR, sorry for not giving love to this project anymore ❤️

Drarig29 avatar Sep 07 '25 10:09 Drarig29

The changes are released in https://github.com/Drarig29/brackets-viewer.js/releases/tag/v1.7.0

Drarig29 avatar Sep 07 '25 10:09 Drarig29

The changes are released in https://github.com/Drarig29/brackets-viewer.js/releases/tag/v1.7.0

You already did a lot man! I hope I can contribute asap if I find anything helpful!

joaquinjsb avatar Sep 07 '25 10:09 joaquinjsb

@joaquinjsb I just updated the docs with a lot of content. Hope it will help!

https://drarig29.github.io/brackets-docs/

Drarig29 avatar Sep 07 '25 16:09 Drarig29

@joaquinjsb I just updated the docs with a lot of content. Hope it will help!

https://drarig29.github.io/brackets-docs/

Just gave a look, a lot of things makes more sense now, thank you very much !

joaquinjsb avatar Sep 07 '25 17:09 joaquinjsb