Skip to content

Commit

Permalink
refactor: some more ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Skn0tt committed Nov 27, 2023
1 parent 11a54b7 commit 5024ba8
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/lib/functions/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,17 @@ const ZIP_EXTENSION = '.zip'
*/

export class FunctionsRegistry {
/**
* The functions held by the registry
*/
private functions = new Map<string, NetlifyFunction>()

/**
* File watchers for function files. Maps function names to objects built
* by the `watchDebounced` utility.
*/
private functionWatchers = new Map<string, Awaited<ReturnType<typeof watchDebounced>>>()

constructor({
// @ts-expect-error TS(7031) FIXME: Binding element 'blobsContext' implicitly has an '... Remove this comment to see the full error message
blobsContext,
Expand Down Expand Up @@ -97,15 +106,6 @@ export class FunctionsRegistry {
// @ts-expect-error TS(2339) FIXME: Property 'directoryWatchers' does not exist on typ... Remove this comment to see the full error message
this.directoryWatchers = new Map()

/**
* File watchers for function files. Maps function names to objects built
* by the `watchDebounced` utility.
*
* @type {Map<string, Awaited<ReturnType<watchDebounced>>>}
*/
// @ts-expect-error TS(2339) FIXME: Property 'functionWatchers' does not exist on type... Remove this comment to see the full error message
this.functionWatchers = new Map()

/**
* Keeps track of whether we've checked whether `TYPES_PACKAGE` is
* installed.
Expand Down Expand Up @@ -232,7 +232,6 @@ export class FunctionsRegistry {
return
}

// @ts-expect-error TS(2339) FIXME: Property 'functionWatchers' does not exist on type... Remove this comment to see the full error message
const watcher = this.functionWatchers.get(func.name)

// If there is already a watcher for this function, we need to unwatch any
Expand Down Expand Up @@ -261,7 +260,6 @@ export class FunctionsRegistry {
},
})

// @ts-expect-error TS(2339) FIXME: Property 'functionWatchers' does not exist on type... Remove this comment to see the full error message
this.functionWatchers.set(func.name, newWatcher)
}
}
Expand Down

0 comments on commit 5024ba8

Please sign in to comment.