Replies: 3 comments 1 reply
-
FWIW - Typescript has some utility type helpers that can sometimes be used when a type you wanted to use isn't exported: https://www.typescriptlang.org/docs/handbook/utility-types.html#returntypetype. Perhaps something like that could work in this case? |
Beta Was this translation helpful? Give feedback.
-
Thanks for the suggestion. I tried it, but it doesn't solve the problem, because I still need to import the TooltipContent type from somewhere. I could copy the type from deckgl to my code or use the any type. Both options are not a real solution. |
Beta Was this translation helpful? Give feedback.
-
Can you share the specific error TS is giving you that makes you need to assert the return type? |
Beta Was this translation helpful? Give feedback.
-
I'm not an expert in Typescript, so I'm not sure whether I found an issue in the deckgl type declarations or I made a mistake in my code.
I want to show a custom tooltip on a layer and that tooltip should contain HTML. To make the type system happy, I'm using the type
TooltipContent
as the return type for my function. It looks like this:Unfortunately the type
TooltipContent
isn't exported from@deck.gl/core
, so I used the following import:This import works, but causes a warning in VS Code saying
Cannot find module @deck.gl/core/lib/tooltip or its corresponding type declarations
. Is here a Typescript expert, who can advice on this issue? My impression is, that the typeTooltipContent
should be exported in the file https://github.com/visgl/deck.gl/blob/master/modules/core/src/index.ts , somewhere after line 111.Beta Was this translation helpful? Give feedback.
All reactions