22 lines
651 B
TypeScript
22 lines
651 B
TypeScript
/*
|
|
* Generated type guards for "types.ts".
|
|
* WARNING: Do not manually change this file.
|
|
*/
|
|
import { DuckSort } from "./types";
|
|
|
|
export function isDuckSort(obj: unknown): obj is DuckSort {
|
|
const typedObj = obj as DuckSort
|
|
return (
|
|
(typedObj !== null &&
|
|
typeof typedObj === "object" ||
|
|
typeof typedObj === "function") &&
|
|
typeof typedObj["name"] === "string" &&
|
|
typeof typedObj["id"] === "number" &&
|
|
typeof typedObj["species"] === "string" &&
|
|
Array.isArray(typedObj["habitat"]) &&
|
|
typedObj["habitat"].every((e: any) =>
|
|
typeof e === "string"
|
|
)
|
|
)
|
|
}
|