Skip to content

Commit

Permalink
Migrate @emotion/hash to TypeScript (#2454)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist committed Aug 15, 2021
1 parent 16d8a8c commit ea2c397
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/stale-dogs-wink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@emotion/hash': patch
---

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/hash/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@
"description": "A MurmurHash2 implementation",
"main": "dist/emotion-hash.cjs.js",
"module": "dist/emotion-hash.esm.js",
"types": "types/index.d.ts",
"types": "dist/emotion-hash.cjs.d.ts",
"license": "MIT",
"repository": "https://github.com/emotion-js/emotion/tree/main/packages/hash",
"publishConfig": {
"access": "public"
},
"files": [
"src",
"dist",
"types/*.d.ts"
"dist"
],
"scripts": {
"test:typescript": "dtslint types"
Expand Down
2 changes: 1 addition & 1 deletion packages/hash/src/index.js → packages/hash/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Inspired by https://github.com/garycourt/murmurhash-js
// Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86

export default function murmur2(str /*: string */) {
export default function murmur2(str: string): string {
// 'm' and 'r' are mixing constants generated offline.
// They're not really 'magic', they just happen to work well.

Expand Down
2 changes: 1 addition & 1 deletion packages/hash/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export default function murmurhash2_32_gc(str: string): string
export { default } from '../src'

0 comments on commit ea2c397

Please sign in to comment.