Skip to content
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

fix(emotion,shared-types): better TS types for theme objects and their overrides #1780

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

matyasf
Copy link
Collaborator

@matyasf matyasf commented Nov 19, 2024

Also convert some of the final files in the docs app to TS and improve their typing

TEST PLAN:
Try to make various theme and override objects, they should have nice autocomplete and no errors

…r overrides

Also convert some of the final files in the docs app to TS and improve their typing
TEST PLAN:
Try to make various theme and override objects, they should have nice autocomplete and no errors
@matyasf matyasf self-assigned this Nov 19, 2024
@@ -87,3 +141,62 @@ export type {
GenerateStyle,
ComponentStyle
}
/*
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left this here intentionally to test this complex type

@@ -29,21 +29,75 @@ import type {
DeepPartial
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type changes in this file and the main change

Copy link

PR Preview Action v1.4.8
🚀 Deployed preview to https://instructure.github.io/instructure-ui/pr-preview/pr-1780/
on branch gh-pages at 2024-11-19 10:27 UTC

@@ -130,4 +130,4 @@ export { Drilldown } from '@instructure/ui-drilldown'
export { SourceCodeEditor } from '@instructure/ui-source-code-editor'
export { TopNavBar } from '@instructure/ui-top-nav-bar'
export { TruncateList } from '@instructure/ui-truncate-list'
export { canvas, canvasHighContrast, instructure } from '@instructure/ui-themes'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was left here from v9... we really need to type check the docs app

@@ -47,6 +46,19 @@ type AllowedPropKeys = Readonly<Array<PropKeys>>

type DocumentProps = DocumentOwnProps & WithStyleProps<null, DocumentStyle>

// TODO this does not match the TS type either fix or remove
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just moved from /__docs__/src/propTypes.js

Comment on lines +51 to +52
// matches whitespace at the end of a string
line.replace(/\s*$/, '')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think .replace() does not change the original string, so the whitespace isn't actually removed. The result should be reassigned e.g.: line = line.replace(/\s*$/, '')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants