Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing typings to enable prefixing of ipc messages without inducing a value not used error #15

Open
StoneT2000 opened this issue Nov 20, 2021 · 0 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@StoneT2000
Copy link
Member

Currently we do something like this

import type { MainProcessApi } from '../types';
import * as actions from './actions';

const DimensionsApi = {
  prefix: 'dim',
  actions,
} as const;

export type Dimensions = typeof DimensionsApi;

export default DimensionsApi;

// eslint-disable-next-line @typescript-eslint/no-unused-vars
// @ts-expect-error - want to check for typing but ignore no unused locals here
const typecheck = DimensionsApi as MainProcessApi; // should error if it doesn't conform

to create the ipc channels really easily with typings so both the main and renderer process have access to proper typings for what info can go across the ipc channels. We additionally want to be able to prefix the name of the messages so we sort of scope ipc messages without cluttering. However, a consequence is that we get this unused variable error in the current implementation.

@StoneT2000 StoneT2000 added bug Something isn't working enhancement New feature or request labels Nov 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant