Skip to content

Commit

Permalink
Fixed the meta property type
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaakko Heusala committed Apr 16, 2024
1 parent 42d1f1a commit 47c83fe
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
13 changes: 10 additions & 3 deletions wordpress/dto/WpPageDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ import { explainWpPageStatus, isWpPageStatus, WpPageStatus } from "./WpPageStatu
import { explainString, explainStringOrNull, isString, isStringOrNull } from "../../types/String";
import { explainRegularObject, isRegularObject } from "../../types/RegularObject";
import { explainNoOtherKeysInDevelopment, hasNoOtherKeysInDevelopment } from "../../types/OtherKeys";
import { explainReadonlyJsonArray, explainReadonlyJsonObject, isReadonlyJsonArray, isReadonlyJsonObject, ReadonlyJsonArray, ReadonlyJsonObject } from "../../Json";
import {
explainReadonlyJsonAny,
explainReadonlyJsonObject,
isReadonlyJsonAny,
isReadonlyJsonObject,
ReadonlyJsonArray,
ReadonlyJsonObject,
} from "../../Json";
import { explain, explainProperty } from "../../types/explain";
import { explainWpRenderedDTO, isWpRenderedDTO, WpRenderedDTO } from "./WpRenderedDTO";
import { explainNumber, isNumber } from "../../types/Number";
Expand Down Expand Up @@ -86,7 +93,7 @@ export function isWpPageDTO (value:any): value is WpPageDTO {
&& isString(value?.comment_status)
&& isString(value?.ping_status)
&& isNumber(value?.menu_order)
&& isReadonlyJsonArray(value?.meta)
&& isReadonlyJsonAny(value?.meta)
&& isString(value?.template)
&& isString(value?.link)
&& isString(value?.slug)
Expand Down Expand Up @@ -139,7 +146,7 @@ export function explainWpPageDTO (value: any) : string {
, explainProperty("comment_status", explainString(value?.comment_status))
, explainProperty("ping_status", explainString(value?.ping_status))
, explainProperty("menu_order", explainNumber(value?.menu_order))
, explainProperty("meta", explainReadonlyJsonArray(value?.meta))
, explainProperty("meta", explainReadonlyJsonAny(value?.meta))
, explainProperty("template", explainString(value?.template))
, explainProperty("link", explainString(value?.link))
, explainProperty("slug", explainString(value?.slug))
Expand Down
15 changes: 11 additions & 4 deletions wordpress/dto/WpPostDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ import { explainRegularObject, isRegularObject } from "../../types/RegularObject
import { explainNoOtherKeysInDevelopment, hasNoOtherKeysInDevelopment } from "../../types/OtherKeys";
import { explainWpRenderedDTO, isWpRenderedDTO, WpRenderedDTO } from "./WpRenderedDTO";
import { explainNumber, isNumber } from "../../types/Number";
import { explainReadonlyJsonArray, explainReadonlyJsonObject, isReadonlyJsonArray, isReadonlyJsonObject, ReadonlyJsonArray, ReadonlyJsonObject } from "../../Json";
import {
explainReadonlyJsonAny,
explainReadonlyJsonObject,
isReadonlyJsonAny,
isReadonlyJsonObject,
ReadonlyJsonAny,
ReadonlyJsonObject,
} from "../../Json";
import { explain, explainProperty } from "../../types/explain";
import { explainBoolean, isBoolean } from "../../types/Boolean";
import { explainNumberArray, isNumberArray } from "../../types/NumberArray";
Expand Down Expand Up @@ -35,7 +42,7 @@ export interface WpPostDTO {
* @fixme Add correct typing before using this property!
* @deprecated (just so that IDE highlights and you read above comment)
*/
readonly meta : ReadonlyJsonArray;
readonly meta : ReadonlyJsonAny;

readonly template : string;
readonly date_gmt : string | null;
Expand Down Expand Up @@ -97,7 +104,7 @@ export function isWpPostDTO (value:any): value is WpPostDTO {
&& isString(value?.modified_gmt)
&& isString(value?.link)
&& isString(value?.ping_status)
&& isReadonlyJsonArray(value?.meta)
&& isReadonlyJsonAny(value?.meta)
&& isString(value?.template)
&& isStringOrNull(value?.date_gmt)
&& isString(value?.format)
Expand Down Expand Up @@ -154,7 +161,7 @@ export function explainWpPostDTO (value: any) : string {
, explainProperty("featured_media", explainNumber(value?.featured_media))
, explainProperty("comment_status", explainString(value?.comment_status))
, explainProperty("ping_status", explainString(value?.ping_status))
, explainProperty("meta", explainReadonlyJsonArray(value?.meta))
, explainProperty("meta", explainReadonlyJsonAny(value?.meta))
, explainProperty("template", explainString(value?.template))
, explainProperty("date_gmt", explainStringOrNull(value?.date_gmt))
, explainProperty("format", explainString(value?.format))
Expand Down

0 comments on commit 47c83fe

Please sign in to comment.