-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
5 update add type declaration dts file #6
base: master
Are you sure you want to change the base?
Conversation
Thanks @dpeachpeach! The next step is to combine these d.ts files into index.d.ts, which will work with index.js under
|
@@ -18,6 +18,7 @@ | |||
"babelify": "^10.0.0", | |||
"base64-js": "^1.5.1", | |||
"compression-webpack-plugin": "^7.1.2", | |||
"dts-bundle": "^0.7.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import GeoDaLisa from './geoda-lisa'; | ||
import GeoDaWeights from './geoda-weights'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import types GeoDaLisa
and GeoDaWeights
that have been used in functions like getDistanceWeights(): GeoDaWeights
instead of getDistanceWeights(): any
import GeoDaWasm from "./geoda-proxy"; | ||
|
||
export function New(): Promise<GeoDaWasm>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Manually added index.d.ts to expose New() function, which is the only entry of the jsgeoda library, and return GeoDaWasm
type.
dts.bundle({ | ||
name: 'jsgeoda', | ||
main: 'src/index.d.ts', | ||
out: '../lib/index.d.ts' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use dts-bundle in webpack to merge multiple d.ts typings into lib/index.d.ts
@dpeachpeach
@dpeachpeach See my changes and comments above. You should be able to run |
4f73eb1
to
f4e5d69
Compare
Hey @lixun910 , I successfully generated the file and it is more precise but it still seems like it sets multiple type signatures to any. We can discuss in the meeting. |
@dpeachpeach I've made some changes to this branch, you can do |
@dpeachpeach Please also update the version to 0.2.10 in package.json Thanks! |
@@ -37,6 +38,7 @@ | |||
"version": "0.2.9", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"version": "0.2.9", | |
"version": "0.2.10", |
Adding type declarations for the src code.