Skip to content

Commit

Permalink
fix typings
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-marechal committed May 26, 2022
1 parent 5c7edfa commit f9afc45
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion dev-packages/application-manager/src/rebuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ async function runElectronRebuild(modules: string[], forceAbi: NodeABI | undefin
if (signal) {
reject(new Error(`electron-rebuild exited with "${signal}"`));
} else {
resolve(code);
resolve(code!);
}
});
});
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-ext/src/hosted/node/hosted-plugin-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class HostedPluginProcess implements ServerPluginRunner {

const waitForTerminated = new Deferred<void>();
cp.on('message', message => {
const msg = JSON.parse(message);
const msg = JSON.parse(message as string);
if ('type' in msg && msg.type === MessageType.Terminated) {
waitForTerminated.resolve();
}
Expand Down Expand Up @@ -158,7 +158,7 @@ export class HostedPluginProcess implements ServerPluginRunner {
});
this.childProcess.on('message', message => {
if (this.client) {
this.client.postMessage(PLUGIN_HOST_BACKEND, message);
this.client.postMessage(PLUGIN_HOST_BACKEND, message as string);
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-ext/src/hosted/node/plugin-host-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class PluginHostRPC {
console.log('PLUGIN_HOST(' + process.pid + '): PluginManagerExtImpl/loadPlugin(' + plugin.pluginPath + ')');
// cleaning the cache for all files of that plug-in.
Object.keys(require.cache).forEach(function (key): void {
const mod: NodeJS.Module = require.cache[key];
const mod: NodeJS.Module = require.cache[key]!;

// attempting to reload a native module will throw an error, so skip them
if (mod.id.endsWith('.node')) {
Expand Down
10 changes: 5 additions & 5 deletions packages/process/src/node/multi-ring-buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class MultiRingBufferReadableStream extends stream.Readable implements Di

constructor(protected readonly ringBuffer: MultiRingBuffer,
protected readonly reader: number,
protected readonly encoding = 'utf8'
protected readonly encoding: BufferEncoding = 'utf8'
) {
super();
this.setEncoding(encoding);
Expand Down Expand Up @@ -81,7 +81,7 @@ export class MultiRingBufferReadableStream extends stream.Readable implements Di
export const MultiRingBufferOptions = Symbol('MultiRingBufferOptions');
export interface MultiRingBufferOptions {
readonly size: number,
readonly encoding?: string,
readonly encoding?: BufferEncoding,
}

export interface WrappedPosition { newPos: number, wrap: boolean }
Expand All @@ -93,7 +93,7 @@ export class MultiRingBuffer implements Disposable {
protected head: number = -1;
protected tail: number = -1;
protected readonly maxSize: number;
protected readonly encoding: string;
protected readonly encoding: BufferEncoding;

/* <id, position> */
protected readonly readers: Map<number, number>;
Expand Down Expand Up @@ -160,7 +160,7 @@ export class MultiRingBuffer implements Disposable {
this.readers.delete(id);
}

getStream(encoding?: string): MultiRingBufferReadableStream {
getStream(encoding?: BufferEncoding): MultiRingBufferReadableStream {
const reader = this.getReader();
const readableStream = new MultiRingBufferReadableStream(this, reader, encoding);
this.streams.set(readableStream, reader);
Expand All @@ -185,7 +185,7 @@ export class MultiRingBuffer implements Disposable {
}
}

deq(id: number, size = -1, encoding = 'utf8'): string | undefined {
deq(id: number, size = -1, encoding: BufferEncoding = 'utf8'): string | undefined {
const pos = this.readers.get(id);
if (pos === undefined || pos === -1) {
return undefined;
Expand Down
7 changes: 1 addition & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2481,12 +2481,7 @@
"@types/node" "*"
form-data "^3.0.0"

"@types/node@*", "@types/node@12", "@types/node@>=10.0.0", "@types/node@^10.14.22", "@types/node@^14.6.2":
version "12.20.49"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.49.tgz#97897a33dd145490f514bbcbccefc178534e360f"
integrity sha512-5e6QNb9bkeh4Hni4ktLqUZuUqnGTX/kou2aZkXyxtuYaHXgBm+In1SHR9V+7kDzWzjB08KC2uqt2doDi7cuAAA==

"@types/node@14":
"@types/node@*", "@types/node@14", "@types/node@>=10.0.0", "@types/node@^10.14.22", "@types/node@^14.6.2":
version "14.18.18"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.18.tgz#5c9503030df484ccffcbb935ea9a9e1d6fad1a20"
integrity sha512-B9EoJFjhqcQ9OmQrNorItO+OwEOORNn3S31WuiHvZY/dm9ajkB7AKD/8toessEtHHNL+58jofbq7hMMY9v4yig==
Expand Down

0 comments on commit f9afc45

Please sign in to comment.