Skip to content

Commit

Permalink
Add typings for module and submodules
Browse files Browse the repository at this point in the history
Improve DX of typings

Revert "Improve DX of typings"

This reverts commit 46c2d36.
  • Loading branch information
stramel authored and Michael Stramel committed Nov 15, 2019
1 parent 6402127 commit 7f1e6ca
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 5 deletions.
1 change: 1 addition & 0 deletions hardware-concurrency/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export function useHardwareConcurrency(): { unsupported: true } | { numberOfLogicalProcessors: number }
4 changes: 4 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './hardware-concurrency'
export * from './memory'
export * from './network'
export * from './save-data'
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { default as useNetworkStatus } from './network';
export { default as useSaveData } from './save-data';
export { default as useMemoryStatus } from './memory';
export { default as useHardwareConcurrency } from './hardware-concurrency';
export { useNetworkStatus } from './network';
export { useSaveData } from './save-data';
export { useMemoryStatus } from './memory';
export { useHardwareConcurrency } from './hardware-concurrency';
6 changes: 6 additions & 0 deletions memory/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export function useMemoryStatus(): { unsupported: true } | {
deviceMemory: number,
totalJSHeapSize: number | null,
usedJSHeapSize: number | null,
jsHeapSizeLimit: number | null
}
5 changes: 5 additions & 0 deletions network/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export type EffectiveConnectionType = 'slow-2g' | '2g' | '3g' | '4g'

export function useNetworkStatus(): { unsupported: true } | {
effectiveConnectionType: EffectiveConnectionType
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.0.5",
"description": "Give users a great experience best suited to their device and network constraints",
"main": "index.js",
"typings": "index.d.ts",
"repository": "https://github.com/GoogleChromeLabs/react-adaptive-hooks",
"author": "Google Chrome",
"license": "Apache-2.0",
Expand Down Expand Up @@ -31,4 +32,4 @@
"react",
"performance"
]
}
}
1 change: 1 addition & 0 deletions save-data/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export function useSaveData(): { unsupported: boolean, saveData: boolean | null }

0 comments on commit 7f1e6ca

Please sign in to comment.