Skip to content

Commit 4fd20c4

Browse files
committed
fixup! add more typedefs
Signed-off-by: Miroslav Bajtoš <[email protected]>
1 parent 0359412 commit 4fd20c4

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

main/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ const { setupAppMenu } = require('./app-menu')
1515
const { ActivityLog } = require('./activity-log')
1616
const { ipcMain } = require('electron/main')
1717

18+
/** @typedef {import('./typings').ActivityEvent} ActivityEvent */
19+
1820
const inTest = (process.env.NODE_ENV === 'test')
1921

2022
if (!app.isPackaged && !inTest) {
@@ -89,7 +91,7 @@ async function run () {
8991
const activityLog = new ActivityLog()
9092

9193
/**
92-
* @param {import('./typings').ActivityEvent} event
94+
* @param {ActivityEvent} event
9395
*/
9496
function recordActivity (event) {
9597
const entry = activityLog.recordEvent(event)

main/ipc.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ const { ipcMain } = require('electron')
55
const saturnNode = require('./saturn-node')
66
const stationConfig = require('./station-config')
77

8+
/** @typedef {import('./typings').Context} Context */
9+
810
const ipcMainEvents = Object.freeze({
911
ACTIVITY_LOGGED: 'station:activity-logged',
1012

1113
UPDATE_CHECK_STARTED: 'station:update-check:started',
1214
UPDATE_CHECK_FINISHED: 'station:update-check:finished'
1315
})
1416

15-
function setupIpcMain (/** @type {import('./typings').Context} */ ctx) {
17+
function setupIpcMain (/** @type {Context} */ ctx) {
1618
ipcMain.handle('saturn:isRunning', saturnNode.isRunning)
1719
ipcMain.handle('saturn:isReady', saturnNode.isReady)
1820
ipcMain.handle('saturn:start', _event => saturnNode.start(ctx))

main/saturn-node.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ const Store = require('electron-store')
1212
const consts = require('./consts')
1313
const configStore = new Store()
1414

15+
/** @typedef {import('./typings').Context} Context */
16+
1517
const saturnBinaryPath = getSaturnBinaryPath()
1618

1719
/** @type {import('execa').ExecaChildProcess | null} */
@@ -31,7 +33,7 @@ const ConfigKeys = {
3133

3234
let filAddress = /** @type {string | undefined} */ (configStore.get(ConfigKeys.FilAddress))
3335

34-
async function setup (/** @type {import('./typings').Context} */ ctx) {
36+
async function setup (/** @type {Context} */ ctx) {
3537
console.log('Using Saturn L2 Node binary: %s', saturnBinaryPath)
3638

3739
const stat = await fs.stat(saturnBinaryPath)
@@ -55,7 +57,7 @@ function getSaturnBinaryPath () {
5557
: path.resolve(__dirname, '..', 'build', 'saturn', `l2node-${process.platform}-${arch}`, name)
5658
}
5759

58-
async function start (/** @type {import('./typings').Context} */ ctx) {
60+
async function start (/** @type {Context} */ ctx) {
5961
if (!filAddress) {
6062
console.info('Saturn node requires FIL address. Please configure it in the Station UI.')
6163
return
@@ -218,7 +220,7 @@ function appendToChildLog (text) {
218220
}
219221

220222
/**
221-
* @param {import('./typings').Context} ctx
223+
* @param {Context} ctx
222224
* @param {string} text
223225
*/
224226
function handleActivityLogs (ctx, text) {

main/test/activity-log.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ const assert = require('assert').strict
44
const { ActivityLog } = require('../activity-log')
55
const { assertTimestampIsCloseToNow, pickProps } = require('./test-helpers')
66

7+
/** @typedef {import('../typings').ActivityEvent} ActivityEvent */
8+
79
describe('ActivityLog', function () {
810
beforeEach(function () { return ActivityLog.reset() })
911

@@ -65,8 +67,8 @@ describe('ActivityLog', function () {
6567
})
6668

6769
/**
68-
* @param {Partial<import('../typings').ActivityEvent>} [props]
69-
* @returns {import('../typings').ActivityEvent}
70+
* @param {Partial<ActivityEvent>} [props]
71+
* @returns {ActivityEvent}
7072
*/
7173
function givenActivity (props) {
7274
return {

0 commit comments

Comments
 (0)