Skip to content

Commit

Permalink
Fix TS lint-level error for consistent returns
Browse files Browse the repository at this point in the history
Explicitly do a consistent return from a number of spots which TS 5.1
nightlies are catching, and which previous versions did not. In these
cases, we explicitly return `undefined`, which is equivalent to the
previous behavior.
  • Loading branch information
chriskrycho committed Apr 3, 2023
1 parent 7c6fec2 commit 6b386ae
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
4 changes: 1 addition & 3 deletions packages/@ember/-internals/runtime/lib/mixins/-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ const ProxyMixin = Mixin.create({

unknownProperty(key: string) {
let content = contentFor(this);
if (content) {
return get(content, key);
}
return content ? get(content, key) : undefined;
},

setUnknownProperty(key: string, value: unknown) {
Expand Down
1 change: 1 addition & 0 deletions packages/@ember/debug/lib/deprecate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ if (DEBUG) {
captureErrorForStack = () => {
try {
__fail__.fail();
return;
} catch (e) {
return e;
}
Expand Down
9 changes: 3 additions & 6 deletions packages/@ember/object/observable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ interface Observable {
Remove an observer you have previously registered on this object. Pass
the same key, target, and method you passed to `addObserver()` and your
target will no longer receive notifications.
@method removeObserver
@param {String} key The key to observe
@param {Object} target The target object to invoke
Expand Down Expand Up @@ -400,7 +400,7 @@ interface Observable {
This allows you to inspect the value of a computed property
without accidentally invoking it if it is intended to be
generated lazily.
@method cacheFor
@param {String} keyName
@return {Object} The cached value of the computed property, if any
Expand Down Expand Up @@ -526,10 +526,7 @@ const Observable = Mixin.create({

cacheFor(keyName: string) {
let meta = peekMeta(this);

if (meta !== null) {
return meta.valueFor(keyName);
}
return meta !== null ? meta.valueFor(keyName) : undefined;
},
});

Expand Down

0 comments on commit 6b386ae

Please sign in to comment.