Skip to content

Commit c5af5d9

Browse files
stramelMichael Stramel
authored and
Michael Stramel
committed
Add typings for module and submodules
Improve DX of typings Revert "Improve DX of typings" This reverts commit 46c2d36.
1 parent 61f923e commit c5af5d9

File tree

6 files changed

+19
-1
lines changed

6 files changed

+19
-1
lines changed

hardware-concurrency/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export function useHardwareConcurrency(): { unsupported: true } | { numberOfLogicalProcessors: number }

index.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export * from './hardware-concurrency'
2+
export * from './memory'
3+
export * from './network'
4+
export * from './save-data'

memory/index.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export function useMemoryStatus(): { unsupported: true } | {
2+
deviceMemory: number,
3+
totalJSHeapSize: number | null,
4+
usedJSHeapSize: number | null,
5+
jsHeapSizeLimit: number | null
6+
}

network/index.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export type EffectiveConnectionType = 'slow-2g' | '2g' | '3g' | '4g'
2+
3+
export function useNetworkStatus(): { unsupported: true } | {
4+
effectiveConnectionType: EffectiveConnectionType
5+
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"module": "dist/index.mjs",
1111
"unpkg": "dist/index.umd.js",
1212
"source": "index.js",
13+
"typings": "index.d.ts",
1314
"scripts": {
1415
"build": "microbundle",
1516
"dev": "microbundle watch",
@@ -35,4 +36,4 @@
3536
"react",
3637
"performance"
3738
]
38-
}
39+
}

save-data/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export function useSaveData(): { unsupported: boolean, saveData: boolean | null }

0 commit comments

Comments
 (0)