Skip to content

Commit 2ab9d9f

Browse files
author
Oleksandr Dzhychko
committed
refactor(vue-model-api): fix typos
1 parent 218b09b commit 2ab9d9f

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

vue-model-api/src/internal/ReactiveINodeJS.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ export function toReactiveINodeJS(
1111
return cache.memoize(node, () => new ReactiveINodeJS(node, cache));
1212
}
1313

14-
// This declaration specifies the types of the implemenation in `unwrapReactiveINodeJS` further.
14+
// This declaration specifies the types of the implementation in `unwrapReactiveINodeJS` further.
1515
// It declares, that when
1616
// * an `INodeJS` is given an `INodeJS` is returned
1717
// * an `undefined` is given an `undefined` is returned
1818
// * an `null` is given an `null` is returned
19-
// This so called conditional types help avoid unneed assertsion about types on the usage site.
19+
// This so called conditional types help avoid unneeded assertions about types on the usage site.
2020
// See. https://www.typescriptlang.org/docs/handbook/2/conditional-types.html
2121
function unwrapReactiveINodeJS<T extends INodeJS | null | undefined>(
2222
maybeReactive: T,
@@ -34,7 +34,7 @@ function unwrapReactiveINodeJS(
3434
}
3535
}
3636

37-
// `any` is currectly provided as the type for references from `@modelix/ts-model-api`,
37+
// `any` is correctly provided as the type for references from `@modelix/ts-model-api`,
3838
// so we have to work with it for now.
3939
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4040
type INodeReferenceJS = any;
@@ -108,10 +108,10 @@ export class ReactiveINodeJS implements INodeJS {
108108

109109
getParent(): INodeJS | undefined {
110110
// This does not need to be made reacitve for the same reason as getRoleInParent
111-
const unreacitveNode = this.unreactiveNode.getParent();
112-
return unreacitveNode
113-
? toReactiveINodeJS(unreacitveNode, this.cache)
114-
: unreacitveNode;
111+
const unreactiveNode = this.unreactiveNode.getParent();
112+
return unreactiveNode
113+
? toReactiveINodeJS(unreactiveNode, this.cache)
114+
: unreactiveNode;
115115
}
116116

117117
remove(): void {
@@ -143,12 +143,12 @@ export class ReactiveINodeJS implements INodeJS {
143143
index: number,
144144
concept: IConceptJS | undefined,
145145
): INodeJS {
146-
const unreacitveNode = this.unreactiveNode.addNewChild(
146+
const unreactiveNode = this.unreactiveNode.addNewChild(
147147
role,
148148
index,
149149
concept,
150150
);
151-
return toReactiveINodeJS(unreacitveNode, this.cache);
151+
return toReactiveINodeJS(unreactiveNode, this.cache);
152152
}
153153

154154
removeChild(child: INodeJS): void {
@@ -200,7 +200,11 @@ export class ReactiveINodeJS implements INodeJS {
200200
}
201201

202202
getPropertyValue(role: string): string | undefined {
203-
const ref = this.getOrCreateRefForRole(this.byRoleRefToProperty, role, this.propertyGetter);
203+
const ref = this.getOrCreateRefForRole(
204+
this.byRoleRefToProperty,
205+
role,
206+
this.propertyGetter,
207+
);
204208
return ref.value;
205209
}
206210

vue-model-api/src/internal/handleChange.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ type ChangeJS = org.modelix.model.client2.ChangeJS;
99

1010
export function handleChange(change: ChangeJS, cache: Cache<ReactiveINodeJS>) {
1111
const unreactiveNode = change.node;
12-
const reacitveNode = cache.get(unreactiveNode);
13-
if (reacitveNode === undefined) {
12+
const reactiveNode = cache.get(unreactiveNode);
13+
if (reactiveNode === undefined) {
1414
return;
1515
}
1616
if (change instanceof PropertyChanged) {
17-
reacitveNode.triggerChangeInProperty(change.role);
17+
reactiveNode.triggerChangeInProperty(change.role);
1818
} else if (change instanceof ReferenceChanged) {
19-
reacitveNode.triggerChangeInReference(change.role);
19+
reactiveNode.triggerChangeInReference(change.role);
2020
} else if (change instanceof ChildrenChanged) {
21-
reacitveNode.triggerChangeInChild(change.role);
21+
reactiveNode.triggerChangeInChild(change.role);
2222
}
2323
}

vue-model-api/src/internal/useLastPromiseEffect.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import { watchEffect } from "vue";
33
/**
44
* This function takes a `promiseEffect` callback and executes it every time its used reactive values are changed.
55
*
6-
* If a promise is fullfilled, the `onfulfilled` call back is called with the value and aboolean,
6+
* If a promise is fulfilled, the `onfulfilled` call back is called with the value and a boolean,
77
* which indicates if the value is the result of the last create promise.
88
*
99
* If a promise is rejected, the `onrejected` call back is called with the reason and a boolean,
1010
* which indicates if the value is the result of the last create promise.
1111
*
12-
* This function is usefull, if you need to trigger a new promise every time some reavtive value changes and
13-
* then need to distinguashe if the value/error of the settled promise comes from the last started promise.
12+
* This function is useful, if you need to trigger a new promise every time some reavtive value changes and
13+
* then need to distinguish if the value/error of the settled promise comes from the last started promise.
1414
*
1515
* @param promiseEffect A function that may create a new promise.
1616
*
@@ -30,7 +30,7 @@ export function useLastPromiseEffect<ValueT>(
3030
const thisPromise = promiseEffect();
3131
lastStartedPromise = thisPromise;
3232
const isResultOfLastStartedPromise = () =>
33-
// `lastStartedPromise` might be diffrent to `thisPromise`,
33+
// `lastStartedPromise` might be different to `thisPromise`,
3434
// because this function gets called asynchronously, when `thisPromise` is settled.
3535
// In the meantime `promiseEffect()` might have been called again and assigned a new value to `lastStartedPromise`.
3636
lastStartedPromise == thisPromise;

0 commit comments

Comments
 (0)