deckgl-typings
deckgl-typings copied to clipboard
Trouble with installation
Hey Dan,
I'm new to typescript but I'm migrating a maptool I developed in deck.gl. I can't figure out what I'm supposed to do to install IndefinitelyTyped and get the deck.gl types to go to the right place. The readme for both is confusing for someone like me who's fairly new to this stuff.
Is indefinitelytyped supposed to be globally installed? If so, why does it not put the deckgl-typings into my @types in node_modules when I install that in my project?
Thanks for any help
Hi Andrew, you shouldn’t have to install indefinitely-typed. You should only have to npm install @danmarshall/deckgl-typings
. Check the readme in this repo, there was PR yesterday that may add another way for you to get the typings in your project. Sorry I’m on a mobile device right now or else I’d add the link :)
And then you put
import * as DeckTypings from "@danmarshall/deckgl-typings" declare module "deck.gl" { export namespace DeckTypings {} }
at the top of the file usings DeckGL?
In my projects, that part is not needed. However, others have said they do need it. If you use it, I think you can put it in its own .d.ts file or in any .ts file within your project.
Also check out https://github.com/danmarshall/deckgl-typescript-example to see how it all hangs together.
When I install, then put <reference types="deckgl-typings" />
like your sample, I still get Cannot find type definition file for 'deckgl-typings'
ts(2668).
I'm sorry, I don't know what a .d.ts file is. That would just contain the import / declare module code? Where would that typically go in a project?
🤔 not sure where you got <reference types="deckgl-typings" />
... I don't see it in my sample. That is an older style of referencing that we don't use anymore.
Perhaps you can share your repo?
I think I was accidentally looking at an old repo for react examples. Now looking at the new updated one.
My partner and I are beginning to migrate our project that we had originally created in React over to Typescript in Nextjs. The map file is here, and I've just been stuck trying to understand all the linting issues for the last couple days. Any help would be greatly appreciated. Judging from the type of errors I keep getting (tons of property's dont exist on types that don't exist), my assumption is if I could figure out how to load your types, it could compile finally and I could keep working on the migration.
https://github.com/andrewshrout/mapstack/blob/master/app/components/map/OlMap.tsx
Thank you so much for your patience with a new developer.
@andrewshrout you could try to create a file called 'deckgl.d.ts' in your src
folder. And in this file put only this code:
import * as DeckTypings from "@danmarshall/deckgl-typings"
declare module "deck.gl" {
export namespace DeckTypings {}
}
@andrewshrout you could try to create a file called 'deckgl.d.ts
in your
src` folder. And in this file put only this code:import * as DeckTypings from "@danmarshall/deckgl-typings" declare module "deck.gl" { export namespace DeckTypings {} }
This helped me tremendously. Thank you. I will make a PR to the README to add these additional details 😄