Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX beta] fix for TS 5.1 nightly narrowing change #20441

Merged
merged 1 commit into from
Apr 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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