Skip to content

Commit 1e79965

Browse files
committed
Add typings for module and submodules
1 parent d70fb69 commit 1e79965

File tree

6 files changed

+25
-1
lines changed

6 files changed

+25
-1
lines changed

Diff for: hardware-concurrency/index.d.ts

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

Diff for: index.d.ts

+4
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'

Diff for: memory/index.d.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export interface MemoryStatus {
2+
deviceMemory: number,
3+
totalJSHeapSize: number | null,
4+
usedJSHeapSize: number | null,
5+
jsHeapSizeLimit: number | null
6+
}
7+
8+
export function useMemoryStatus(initialMemoryStatus?: MemoryStatus): { unsupported: true } & Partial<MemoryStatus> | {
9+
unsupported: false,
10+
} & MemoryStatus

Diff for: network/index.d.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export type EffectiveConnectionType = 'slow-2g' | '2g' | '3g' | '4g'
2+
3+
export function useNetworkStatus(initialEffectiveConnectionType?: EffectiveConnectionType | null): {
4+
unsupported: boolean,
5+
effectiveConnectionType: EffectiveConnectionType | null
6+
}

Diff for: package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
"main": "dist/index.js",
1010
"module": "dist/index.module.js",
1111
"unpkg": "dist/index.umd.js",
12+
"typings": "index.d.ts",
1213
"source": "index.js",
14+
"typings": "index.d.ts",
1315
"scripts": {
1416
"build": "microbundle",
1517
"dev": "microbundle watch",
@@ -35,4 +37,4 @@
3537
"react",
3638
"performance"
3739
]
38-
}
40+
}

Diff for: save-data/index.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export function useSaveData(initialSaveDataStatus?: boolean | null): { unsupported: boolean, saveData: boolean | null }

0 commit comments

Comments
 (0)