Skip to content

Commit

Permalink
fix(interprocess): issue on a scenario where apiKey type was breaking
Browse files Browse the repository at this point in the history
  • Loading branch information
daltonmenezes committed Nov 19, 2022
1 parent 4717403 commit 6cb14ad
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
6 changes: 6 additions & 0 deletions packages/interprocess/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# interprocess

## 0.2.2

### Patch Changes

- fix an issue where exposeApiToGlobalWindow called without at least with an empty object was breaking the apiKey type

## 0.2.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/interprocess/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "interprocess",
"version": "0.2.1",
"version": "0.2.2",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { contextBridge } from 'electron'

import type { API, StringAssertion } from '../types'
import type { API } from '../types'

const defaultAPIConfig = {
apiKey: 'api',
Expand Down Expand Up @@ -42,10 +42,9 @@ export function createApiToGlobalWindowExposer<Handle, Invoke, Remove>(
publicApi
)

const key = apiKey as StringAssertion<
APIConfig['apiKey'],
typeof defaultAPIConfig.apiKey
>
const key = apiKey as APIConfig['apiKey'] extends string
? APIConfig['apiKey']
: typeof defaultAPIConfig.apiKey

type APIReturn = APIConfig['override'] extends Function
? ReturnType<APIConfig['override']>
Expand Down

0 comments on commit 6cb14ad

Please sign in to comment.