Skip to content

Commit

Permalink
refactor: various (minor) TS4.7 related updates/fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Jun 7, 2022
1 parent 4520f7f commit 9d9ecae
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions packages/associative/src/hash-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ export class HashMap<K, V>
* readonly/immutable. This could be enforced via TS, but would
* break ES6 Map interface contract.
*
* @param fn -
* @param thisArg -
* @param fn -
* @param thisArg -
*/
forEach(fn: Fn3<V, K, Map<K, V>, void>, thisArg?: any) {
for (let pair of __private.get(this)!.bins) {
Expand All @@ -142,7 +142,7 @@ export class HashMap<K, V>
copy() {
const $this = __private.get(this)!;
const m = new HashMap<K, V>(null, this.opts({ cap: 4 }));
Object.assign(__private.get(m), {
Object.assign(__private.get(m)!, {
bins: $this.bins.slice(),
mask: $this.mask,
size: $this.size,
Expand Down
10 changes: 5 additions & 5 deletions packages/parse/src/xform/hoist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ import { xform } from "../combinators/xform.js";
/**
* Replace AST node with its first child node. Also see {@link hoist}.
*
* @param scope -
* @param scope -
*/
export const xfHoist: ScopeTransform<any> = (scope) => {
Object.assign(scope, scope!.children![0]);
Object.assign(scope!, scope!.children![0]);
return scope;
};

/**
* Moves the result of first child node to this node, then discards all
* children. Also see {@link hoistR}.
*
* @param scope -
* @param scope -
*/
export const xfHoistResult: ScopeTransform<any> = (scope) => {
scope!.result = scope!.children![0].result;
Expand All @@ -26,14 +26,14 @@ export const xfHoistResult: ScopeTransform<any> = (scope) => {
/**
* Syntax sugar for `xform(parser, xfHoist)`.
*
* @param parser -
* @param parser -
*/
export const hoist = <T>(parser: Parser<T>) => xform(parser, xfHoist);

/**
* Syntax sugar for `xform(parser, xfHoistR)`.
*
* @param parser -
* @param parser -
*/
export const hoistResult = <T>(parser: Parser<T>) =>
xform(parser, xfHoistResult);
8 changes: 4 additions & 4 deletions packages/rstream/src/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface StreamObj<T, K extends Keys<T>> {
* Feeds new values from `x` to each registered key's stream.
* Satifies {@link ISubscriber.next} interface.
*
* @param x -
* @param x -
*/
next(x: T): void;
/**
Expand Down Expand Up @@ -126,8 +126,8 @@ export interface StreamObjOpts<T, K extends Keys<T>> extends CommonOpts {
* // b foo
* ```
*
* @param src -
* @param opts -
* @param src -
* @param opts -
*/
export const fromObject = <T, K extends Keys<T>>(
src: T,
Expand All @@ -146,7 +146,7 @@ export const fromObject = <T, K extends Keys<T>>(
for (let k of keys) {
streams[k] = subscription(undefined, {
..._opts,
id: `${id}-${k}`,
id: `${id}-${String(k)}`,
});
}
const res = <StreamObj<T, K>>{
Expand Down
4 changes: 2 additions & 2 deletions packages/system/src/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class System<T extends SystemMap<T>> implements ILifecycle {
for (let id of this.topology) {
const comp = this.components[id];
if (comp.start && !(await comp.start())) {
LOGGER.warn(`error starting component: ${id}`);
LOGGER.warn(`error starting component: ${String(id)}`);
return false;
}
}
Expand All @@ -59,7 +59,7 @@ export class System<T extends SystemMap<T>> implements ILifecycle {
const id = topo[i];
const comp = this.components[id];
if (comp.stop && !(await comp.stop())) {
LOGGER.warn(`error stopping component: ${id}`);
LOGGER.warn(`error stopping component: ${String(id)}`);
}
}
return true;
Expand Down

0 comments on commit 9d9ecae

Please sign in to comment.