Skip to content
This repository has been archived by the owner on Oct 4, 2022. It is now read-only.

Declare the window object as a type with the specific links #1125

Merged
merged 1 commit into from
Mar 30, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ enum WarningType {
BLOCK_RECOMMENDED
}

type yoastLinks = {
yoastSchemaBlocks: {
requiredLink: string;
recommendedLink: string;
};
}

/**
* Gets the inner blocks instruction of the block definition with the given name.
*
Expand Down Expand Up @@ -55,7 +62,7 @@ function getDefaultWarningMessage( blockTitle: string, warningType: WarningType
"yoast-schema-blocks",
),
blockTitle,
'<a href="' + ( window as any ).yoastSchemaBlocks.requiredLink + '" target="_blank">',
'<a href="' + ( window as unknown as yoastLinks ).yoastSchemaBlocks.requiredLink + '" target="_blank">',
"</a>",
);
}
Expand All @@ -68,7 +75,7 @@ function getDefaultWarningMessage( blockTitle: string, warningType: WarningType
"yoast-schema-blocks",
),
blockTitle,
'<a href="' + ( window as any ).yoastSchemaBlocks.recommendedLink + '" target="_blank">',
'<a href="' + ( window as unknown as yoastLinks ).yoastSchemaBlocks.recommendedLink + '" target="_blank">',
"</a>",
);
}
Expand Down