add RegExp as typing for target#2457
add RegExp as typing for target#2457Andarist merged 3 commits intoemotion-js:mainfrom jcleefw:tohavestylerule-typings
Conversation
🦋 Changeset detectedLatest commit: b727ac8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit b727ac8:
|
|
Is there already a test that covers a regexp being used as |
yes i believe it's here |
cool! it's good to have this validated |
| property: *, | ||
| value: *, | ||
| options?: { target?: string, media?: string } = {} | ||
| options?: { target?: string | RegExp, media?: string } = {} |
There was a problem hiding this comment.
I suspect that you might have wanted to fix in the TS types which are, currently, located here:
emotion/packages/jest/types/index.d.ts
Line 12 in 639b276
You have only changed the Flow type here - and we are in the process of replacing Flow with TS.
- With typescript in place, the typing that only allows string will not be able to receive a RegExp. Being able to receive a RegExp will allow target options describe in [this issue](#1875)
What:
Following the conversation described in this issue, the suggested solution is to insert regex patterns to ensure matching criteria
Why:
This quick fix will allow exact matching of pseudo-css selector with
regex patterns. The existing implementation will rise issues in typesscript type checking where the function is expectingstringonly.How:
Added typing to receive RegExp
Checklist: