-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
bug: missing export of DatetimeHighlightStyle #27353
Comments
Hello @aparajita thanks for this issue! Can you share your intended usage requiring the To bind to |
Hey @sean-perkins, first of all, since export type DatetimeHighlight = {
date: string;
} & DatetimeHighlightStyle; not exporting Here's the relevant portions of my code: const kDateHighlights: Record<string, DatetimeHighlightStyle> = {
available: {
textColor: 'var(--ion-color-dark-contrast)',
backgroundColor: 'var(--color-available-job)',
},
assigned: {
textColor: 'var(--ion-color-dark-contrast)',
backgroundColor: 'var(--color-assigned-job)',
},
pto: {
textColor: 'var(--ion-color-dark-contrast)',
backgroundColor: 'var(--color-pto)',
},
}
function getDateHighlight(item: ListItem): DatetimeHighlightStyle {
if (isAvailableJob(item)) {
return kDateHighlights.available
} else if (isAssignedJob(item)) {
return kDateHighlights.assigned
} else {
return kDateHighlights.pto
}
}
// Not exactly my code, but the general idea
const highlightedDates = computed((): DatetimeHighlight[] => {
const highlights: DatetimeHighlight[] = []
for (const item of items) {
// Without DatetimeHighlightStyle being defined, TS sees the object
// parameter as `any`.
highlights.push({
date: item.date,
...getDateHighlight(item)
})
}
}) |
@aparajita thanks for the code snippet, that makes sense! Stencil v3 includes a feature that automatically exports types assigned to a I will open #27360 for review. |
Thanks @sean-perkins. I am able to work around it for now by declaring the type myself. |
Issue number: Resolves #27353 --------- <!-- Please refer to our contributing documentation for any questions on submitting a pull request, or let us know here if you need any help: https://ionicframework.com/docs/building/contributing --> <!-- Some docs updates need to be made in the `ionic-docs` repo, in a separate PR. See https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#modifying-documentation for details. --> <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> `DatetimeHighlightStyle` is not automatically exported from `@ionic/core`, since the type is not directly referenced on a prop. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Manually exports `DatetimeHighlightStyle` to consumers ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out. |
Prerequisites
Ionic Framework Version
v7.x
Current Behavior
Although the source does export
DatetimeHighlightStyle
, the built package does not, which results in a TS error when trying to import it.Expected Behavior
DatetimeHighlightStyle
should be exported in the built package.Steps to Reproduce
@ionic/core
does not export that name.Code Reproduction URL
https://stackblitz.com/edit/xkg3uz?file=src/main.ts
Ionic Info
Additional Information
The relevant line in the built package is
@ionic/core/types/components.d.ts
, lines 18 and 54, which sure enough are missing the relevant name:The text was updated successfully, but these errors were encountered: