BIMserver-JavaScript-API | BIMserver JavaScript API | REST library
kandi X-RAY | BIMserver-JavaScript-API Summary
kandi X-RAY | BIMserver-JavaScript-API Summary
BIMserver JavaScript API
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of BIMserver-JavaScript-API
BIMserver-JavaScript-API Key Features
BIMserver-JavaScript-API Examples and Code Snippets
Community Discussions
Trending Discussions on BIMserver-JavaScript-API
QUESTION
I'm trying to write my own library definition for an open source project (https://github.com/opensourceBIM/BIMserver-JavaScript-API), but i'm stuck.
I've managed to clone the repo, and to write the types for the bimserverapipromise.js
module, so now i have the bimserverapipromise.d.ts
(gist) and i can write:
ANSWER
Answered 2018-Oct-29 at 00:47The reason that BimServerClient
behaves differently than BimServerApiPromise
is that your declare module 'BimServerClient'
statement appears in a file with a top-level import, so it is being treated as a module augmentation instead of a module declaration. You could fix that by moving the import BimServerApiPromise from 'BimServerApiPromise';
inside the declare module 'BimServerClient' { ... }
block.
However, a bigger question is whether it is correct to declare modules named BimServerClient
and BimServerApiPromise
in the first place. These names won't work to import the JavaScript modules at runtime unless the calling project sets up some special module loader or bundler configuration. I'd suggest removing the declare module
statement and just putting the contained declarations at the top level of the file. Then any import that resolves to one of the JavaScript files according to normal Node.js module resolution rules will automatically pick up the corresponding .d.ts
file for TypeScript. For your file layout, the correct relative import path to use from index.ts
would be ./BIMServerJavaScriptApi/bimserverclient
and/or ./BIMServerJavaScriptApi/bimserverclient.js
(depending on your module loader or bundler), whereas if you were to install BIMServerJavaScriptApi
as an npm package at node_modules/bimserverapi
, you would use the non-relative import path bimserverapi/bimserverclient
and/or bimserverapi/bimserverclient.js
or simply bimserverapi
(relying on the main
field of package.json
). If you are having trouble with your imports, please update the question and I will be happy to help further.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install BIMserver-JavaScript-API
Install Node.js
Clone (or download and unzip) the project to your file system:
Go to the project directory
Install build dependencies
Run the build script
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page