Skip to content

Commit

Permalink
Merge pull request #20441 from emberjs/fix-ts-nightly
Browse files Browse the repository at this point in the history
[BUGFIX beta] fix for TS 5.1 nightly narrowing change
  • Loading branch information
chriskrycho authored Apr 17, 2023
2 parents 38f53ef + 226fc02 commit 2a8e063
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/@ember/routing/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1850,7 +1850,7 @@ function buildRenderOptions(
options?: PartialRenderOptions
): RenderOptions {
let isDefaultRender = !nameOrOptions && !options;
let _name;
let _name: string;
if (!isDefaultRender) {
if (typeof nameOrOptions === 'object' && !options) {
_name = route.templateName || route.routeName;
Expand All @@ -1860,7 +1860,11 @@ function buildRenderOptions(
'The name in the given arguments is undefined or empty string',
!isEmpty(nameOrOptions)
);
_name = nameOrOptions!;
// SAFETY: the check for `nameOrOptions` above should be validating this,
// and as of TS 5.1.0-dev.2023-0417 it is *not*. This cast can go away if
// TS validates it correctly *or* if we refactor this entire function to
// be less wildly dynamic in its argument handling.
_name = nameOrOptions as string;
}
}
assert(
Expand Down

0 comments on commit 2a8e063

Please sign in to comment.