Skip to content

Commit

Permalink
tweak some minor things
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist committed Aug 14, 2021
1 parent 777f02a commit 887d846
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .changeset/hot-yaks-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'@emotion/is-prop-valid': minor
---

Convert to TypeScript and emit declarations based on the code
Source code has been migrated to TypeScript. From now on type declarations will be emitted based on that, instead of being hand-written.
5 changes: 2 additions & 3 deletions packages/is-prop-valid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "A function to check whether a prop is valid for HTML and SVG elements",
"main": "dist/emotion-is-prop-valid.cjs.js",
"module": "dist/emotion-is-prop-valid.esm.js",
"types": "dist/declarations/src/index.d.ts",
"types": "dist/emotion-is-prop-valid.cjs.d.ts",
"license": "MIT",
"repository": "https://github.com/emotion-js/emotion/tree/main/packages/is-prop-valid",
"scripts": {
Expand All @@ -21,8 +21,7 @@
},
"files": [
"src",
"dist",
"types/*.d.ts"
"dist"
],
"browser": {
"./dist/emotion-is-prop-valid.cjs.js": "./dist/emotion-is-prop-valid.browser.cjs.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/is-prop-valid/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import memoize from '@emotion/memoize'

declare const codegen: { require: (path: string) => RegExp }
declare const codegen: { require: (path: string) => any }

// eslint-disable-next-line no-undef
const reactPropsRegex = codegen.require('./props')
const reactPropsRegex: RegExp = codegen.require('./props')

// https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
const isPropValid = /* #__PURE__ */ memoize(
Expand Down
4 changes: 1 addition & 3 deletions packages/is-prop-valid/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun>
// TypeScript Version: 2.1

declare function isPropValid(string: PropertyKey): boolean
export default isPropValid
export { default } from '../src'
3 changes: 2 additions & 1 deletion packages/is-prop-valid/types/tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"check-preblock"
],

"no-unnecessary-generics": false
"no-unnecessary-generics": false,
"no-default-import": false
}
}
2 changes: 1 addition & 1 deletion packages/memoize/types/tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import memoize from '../src'
import memoize from '@emotion/memoize'

// $ExpectType string[]
memoize((arg: string) => [arg])('foo')
Expand Down
2 changes: 1 addition & 1 deletion packages/weak-memoize/types/tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import weakMemoize from '../src'
import weakMemoize from '@emotion/weak-memoize'

interface Foo {
bar: 'xyz'
Expand Down

0 comments on commit 887d846

Please sign in to comment.