janhommes / o.js

o.js - client side oData lib.
https://janhommes.github.io/o.js/example/
MIT License
241 stars 58 forks source link

typescript definitions for es2015 modules #70

Closed mikejf-pr closed 5 years ago

mikejf-pr commented 6 years ago

I'm running with the @types/odata typings from npm, but as far as I can tell they've been set up in a way that doesn't support imports for es2015 modules, without an export of the interfaces in a way that I can reference in my code.

rriverak commented 6 years ago

Hey, i use this Libary in Typescript without any Problems.

npm install @types/odata

and in my Code

import * as o from 'odata'

o().config({
  endpoint:'https://myBase'
});
o("MyRessouce").Take(10).then(.....

If you call o() without Parameter you get the OHandlerStatic Interface for Gobal Settings. If you call o("MyRessource") with Parameter you get the OHandler<{}> Interface to Request the Ressources.

For my Case i wrote a generic wrapper/factory for o.js to work with Types in o.js Otherwise create your own Definition / Interface.

https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/odata/index.d.ts

janhommes commented 5 years ago

83