-
-
Notifications
You must be signed in to change notification settings - Fork 732
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
Export more types from index.d.ts #618
Conversation
Codecov Report
@@ Coverage Diff @@
## master #618 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 15 15
Lines 621 621
Branches 133 133
=====================================
Hits 621 621 Continue to review full report at Codecov.
|
@@ -2,3 +2,6 @@ | |||
|
|||
import DayPicker from './DayPicker'; | |||
export default DayPicker; | |||
|
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.
if you add export * from './DayPickerInput';
it'll also solve #586
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.
that is semantically incorrect. DayPickerInput is not exported from the root of the package: https://github.com/gpbl/react-day-picker/blob/master/DayPicker.js
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.
Hm, what would be the correct way then? Kinda new to typescript.
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.
since the JS export is from a submodule, you can import in typescript like this:
import { DayPickerInput } from "react-day-picker/DayPickerInput";
that's why types/DayPickerInput.d.ts
exists.
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.
Importing like that doesn't work, my compiler complains about no declaration file found.
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.
hm, ok, can you file an issue for that? I might be able to look into it later
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.
Should I open up a new issue or is #586 good enough? Thank you!
Can someone merge this please? :) |
Hey thanks for the PR! Are we safe with this? I'm not a TS developer, people were fighting for this kind of issues the last time... should I go and merge? |
I am not a TS expert but this PR seems quite fair to me; you can go ahead and merge I guess :) |
This is safe; I contributed to the original types on DefinitelyTyped and in this repo. #586 is a separate issue and can be addressed in another PR. |
Thanks @adidahiya as always! |
Published as v7.1.0. |
Hi guys - just got latest and getting this error:
where line 177 is onDayChange?(day: Date, DayModifiers): void; so this seems like a legitimate issue. Did you mean to do onDayChange?(day: Date, modifiers:DayModifiers): void; |
By the way, you can avoid things like this in the future by switching your tsconfig to {
"compilerOptions": {
"noImplicitAny": true,
...
},
...
} |
Export more types from index.d.ts
Fixes #617