refactor(theme-classic): completely migrate package to TypeScript (#5459)

* Migrate

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Migrate prism as well

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Fix

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Fix lock file

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Fix typing

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* refactor a bit CodeBlock

* simplify versionBanner typing => use null instead of "none" (apart plugin options for retrocompatibility)

* Remove return signatures

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

Co-authored-by: slorber <lorber.sebastien@gmail.com>
This commit is contained in:
Joshua Chen 2021-09-01 20:34:26 +08:00 committed by GitHub
parent 5f003bcabd
commit 78d84006bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 153 additions and 95 deletions

View file

@ -264,10 +264,10 @@ function getDefaultVersionBanner({
versionName: string;
versionNames: string[];
lastVersionName: string;
}): VersionBanner {
}): VersionBanner | null {
// Current version: good, no banner
if (versionName === lastVersionName) {
return 'none';
return null;
}
// Upcoming versions: unreleased banner
else if (
@ -291,17 +291,16 @@ function getVersionBanner({
versionNames: string[];
lastVersionName: string;
options: Pick<PluginOptions, 'versions'>;
}): VersionBanner {
const versionOptionBanner = options.versions[versionName]?.banner;
return (
versionOptionBanner ??
getDefaultVersionBanner({
versionName,
versionNames,
lastVersionName,
})
);
}): VersionBanner | null {
const versionBannerOption = options.versions[versionName]?.banner;
if (versionBannerOption) {
return versionBannerOption === 'none' ? null : versionBannerOption;
}
return getDefaultVersionBanner({
versionName,
versionNames,
lastVersionName,
});
}
function getVersionBadge({