Comments (7)
These compiler options only help, as far as i understand, to import things into your lib. The types have to be correct for that in the first place. (Correct me if im wrong!)
The problem in this case is the duplicate export of the common types.
The library exports methods like isPropertyId and the WDK function and the object returned also contains the common methods.
Normally you would create a namespace and the function with the same name and export that to follow the JS code. But you can not export * from
from within namespaces which creates a lot of method: typeof method
stubs. On the returned interface you have to do the same which creates a lot of typing code just for that. (which is also prone to errors when something changes)
Having the default export you can simply export * from
without the need for the extra namespace and have way less typing code. Also i didnt exported the common methods from the returned object which also simplified the typing code a lot (but thats far from perfect typings).
Personally I think the time invested to type this could be also spent to refactor things. But thats up to everyone themselves. I only started to look differently onto source code since I started using TypeScript and I am not used to code which is used in front end / browsers. The way this library is built certainly has its purpose.
from wikibase-sdk.
new version without the types
: v7.0.8
from wikibase-sdk.
Hello,
is there a status on TypeScript typings ?
looking around in the issues, it seems there used to be typings but they have been deleted ? It seems also there was typings on DefinitelyTyped but they have been deleted as well ?
is there an update on this ?
Thanks for your library ,
from wikibase-sdk.
@r3mi types were added for v6
, but then v7
brought some breaking changes and those types became obsolete so were removed. I don't see any breaking change coming, so if anyone wants to update types for v7
, I would be ok to merge them back. I still don't use Typescript for now, so I can't do the maintenance of those, but it seems that enough people are interested to make it happen and keep those updated.
from wikibase-sdk.
I created the wikibase-types npm package for types returned by the wikibase / wikidata API. Its helpful but still not as good as a fully typed library.
If someone has the time: The typings from #69 could be used to type this library on DefinitelyTyped but without this change the typings seem to get way more complicated than in #69. (Maybe I have overlooked something?)
from wikibase-sdk.
without this change the typings seem to get way more complicated than in #69. (Maybe I have overlooked something?)
That seems weird to me, usually it's not up to the library to write hacks to ensure compatibility between CommonJS and ES modules. I thought that was what the allowSyntheticDefaultImports
TS compiler option did (although there are other options that can enable it implicitly), or maybe esModuleInterop
.
from wikibase-sdk.
Closing in favor of #82
from wikibase-sdk.
Related Issues (20)
- Entity Language Type is incorrect HOT 1
- Types of multiple things are sometimes confusing
- Create dedicated simplifySparqlResultsOneVariable function HOT 1
- Circular Dependencies, Uncaught ReferenceError: can't access lexical declaration 'simplifyEntities' before initialization HOT 7
- Network request failed error HOT 4
- No "export" main defined in package.json HOT 3
- given isEntityId examples all return true
- Convenience module for CommonJS HOT 8
- More examples/samples HOT 2
- Date formatting using moment.js HOT 2
- Musical notation claim parser isn't implemented HOT 5
- Support non-default script path HOT 2
- Support for tabular data HOT 1
- Where are the types definitions as claimed in npm? HOT 2
- Can't resolve 'querystring' HOT 1
- Missing types library HOT 13
- Idea: ActivityStreams JSON-LD HOT 1
- Uncaught (in promise) Error: missing a title HOT 4
- Missing .prettierrc HOT 9
- Compilation fails with latest version HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wikibase-sdk.