Skip to content

Commit

Permalink
Remove TypeScript errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jfmengels committed Oct 14, 2023
1 parent 6070134 commit 4eca814
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
1 change: 0 additions & 1 deletion lib/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ async function buildFromGitHubTemplate(options, template) {
/**
* Create a local temporary project to build an Elm application in.
* @param {Options} options
* @param {Path} reviewElmJsonPath
* @param {Path} userSrc
* @param {Path} projectFolder
* @param {ReviewElmJson} reviewElmJson
Expand Down
20 changes: 11 additions & 9 deletions lib/sync-get-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ const https = require('https');
const {sharedLock, requestPort} = workerData;
const sharedLockArray = new Int32Array(sharedLock);

parentPort.on('message', async (url) => {
try {
const response = await getBody(url);
requestPort.postMessage(response);
} catch (error) {
requestPort.postMessage({error});
}
Atomics.notify(sharedLockArray, 0, Infinity);
});
if (parentPort) {
parentPort.on('message', async (url) => {
try {
const response = await getBody(url);
requestPort.postMessage(response);
} catch (error) {
requestPort.postMessage({error});
}
Atomics.notify(sharedLockArray, 0, Infinity);
});
}

/**
* @param {string} url
Expand Down
3 changes: 3 additions & 0 deletions lib/sync-get.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ function startWorker() {
worker.postMessage(url);
Atomics.wait(sharedLockArray, 0, 0); // blocks until notified at index 0.
const response = receiveMessageOnPort(localPort);
if (!response || !response.message) {
return '';
}
if (response.message.error) {
throw response.message.error;
} else {
Expand Down

0 comments on commit 4eca814

Please sign in to comment.