From 62238c68867816a2e46c84bd87fc2ad728e47093 Mon Sep 17 00:00:00 2001 From: Marcus Pasell <3690498+rickyrombo@users.noreply.github.com> Date: Fri, 17 May 2024 08:22:32 -0700 Subject: [PATCH] [typescript-fetch] Make instanceOf infer type and check for undefineds (#18694) --- .../typescript-fetch/modelGeneric.mustache | 4 +-- .../builds/allOf-nullable/models/Club.ts | 2 +- .../builds/allOf-nullable/models/Owner.ts | 2 +- .../builds/allOf-readonly/models/Club.ts | 2 +- .../builds/allOf-readonly/models/Owner.ts | 2 +- .../models/AdditionalPropertiesClass.ts | 2 +- .../default-v3.0/models/AllOfWithSingleRef.ts | 2 +- .../builds/default-v3.0/models/Animal.ts | 4 +-- .../models/ArrayOfArrayOfNumberOnly.ts | 2 +- .../default-v3.0/models/ArrayOfNumberOnly.ts | 2 +- .../builds/default-v3.0/models/ArrayTest.ts | 2 +- .../default-v3.0/models/Capitalization.ts | 2 +- .../builds/default-v3.0/models/Cat.ts | 2 +- .../builds/default-v3.0/models/Category.ts | 4 +-- .../default-v3.0/models/ChildWithNullable.ts | 2 +- .../builds/default-v3.0/models/ClassModel.ts | 2 +- .../builds/default-v3.0/models/Client.ts | 2 +- .../default-v3.0/models/DeprecatedObject.ts | 2 +- .../builds/default-v3.0/models/Dog.ts | 2 +- .../builds/default-v3.0/models/EnumArrays.ts | 2 +- .../builds/default-v3.0/models/EnumTest.ts | 4 +-- .../models/FakeBigDecimalMap200Response.ts | 2 +- .../models/FileSchemaTestClass.ts | 2 +- .../builds/default-v3.0/models/Foo.ts | 2 +- .../models/FooGetDefaultResponse.ts | 2 +- .../builds/default-v3.0/models/FormatTest.ts | 10 +++---- .../default-v3.0/models/HasOnlyReadOnly.ts | 2 +- .../default-v3.0/models/HealthCheckResult.ts | 2 +- .../builds/default-v3.0/models/List.ts | 2 +- .../builds/default-v3.0/models/MapTest.ts | 2 +- ...dPropertiesAndAdditionalPropertiesClass.ts | 2 +- .../default-v3.0/models/Model200Response.ts | 2 +- .../default-v3.0/models/ModelApiResponse.ts | 2 +- .../builds/default-v3.0/models/ModelFile.ts | 2 +- .../builds/default-v3.0/models/Name.ts | 4 +-- .../default-v3.0/models/NullableClass.ts | 2 +- .../builds/default-v3.0/models/NumberOnly.ts | 2 +- .../models/ObjectWithDeprecatedFields.ts | 2 +- .../builds/default-v3.0/models/Order.ts | 2 +- .../default-v3.0/models/OuterComposite.ts | 2 +- .../models/OuterObjectWithEnumProperty.ts | 4 +-- .../default-v3.0/models/ParentWithNullable.ts | 2 +- .../builds/default-v3.0/models/Pet.ts | 6 ++-- .../default-v3.0/models/ReadOnlyFirst.ts | 2 +- .../builds/default-v3.0/models/Return.ts | 2 +- .../default-v3.0/models/SpecialModelName.ts | 2 +- .../builds/default-v3.0/models/Tag.ts | 2 +- ...lineFreeformAdditionalPropertiesRequest.ts | 2 +- .../builds/default-v3.0/models/User.ts | 2 +- .../builds/default/models/Category.ts | 2 +- .../builds/default/models/ModelApiResponse.ts | 2 +- .../builds/default/models/Order.ts | 2 +- .../builds/default/models/Pet.ts | 6 ++-- .../builds/default/models/Tag.ts | 2 +- .../builds/default/models/User.ts | 2 +- .../builds/enum/models/EnumPatternObject.ts | 2 +- .../FakeEnumRequestGetInline200Response.ts | 2 +- .../builds/es6-target/src/models/Category.ts | 2 +- .../es6-target/src/models/ModelApiResponse.ts | 2 +- .../builds/es6-target/src/models/Order.ts | 2 +- .../builds/es6-target/src/models/Pet.ts | 6 ++-- .../builds/es6-target/src/models/Tag.ts | 2 +- .../builds/es6-target/src/models/User.ts | 2 +- .../multiple-parameters/models/Category.ts | 2 +- .../models/ModelApiResponse.ts | 2 +- .../multiple-parameters/models/Order.ts | 2 +- .../builds/multiple-parameters/models/Pet.ts | 6 ++-- .../builds/multiple-parameters/models/Tag.ts | 2 +- .../builds/multiple-parameters/models/User.ts | 2 +- .../src/models/Category.ts | 2 +- .../src/models/ModelApiResponse.ts | 2 +- .../src/models/Order.ts | 2 +- .../src/models/Pet.ts | 6 ++-- .../src/models/Tag.ts | 2 +- .../src/models/User.ts | 2 +- .../sagas-and-records/src/models/Category.ts | 2 +- .../src/models/DefaultMetaOnlyResponse.ts | 4 +-- .../src/models/FindPetsByStatusResponse.ts | 4 +-- .../src/models/FindPetsByUserResponse.ts | 4 +-- .../models/GetBehaviorPermissionsResponse.ts | 4 +-- .../src/models/GetBehaviorTypeResponse.ts | 4 +-- .../src/models/GetMatchingPartsResponse.ts | 4 +-- .../src/models/GetPetPartTypeResponse.ts | 4 +-- .../sagas-and-records/src/models/ItemId.ts | 6 ++-- .../src/models/MatchingParts.ts | 6 ++-- .../src/models/ModelApiResponse.ts | 2 +- .../src/models/ModelError.ts | 4 +-- .../sagas-and-records/src/models/Order.ts | 2 +- .../sagas-and-records/src/models/Part.ts | 6 ++-- .../sagas-and-records/src/models/Pet.ts | 30 +++++++++---------- .../src/models/PetRegionsResponse.ts | 4 +-- .../src/models/ResponseMeta.ts | 4 +-- .../sagas-and-records/src/models/Tag.ts | 2 +- .../sagas-and-records/src/models/User.ts | 6 ++-- .../models/AdditionalPropertiesClass.ts | 2 +- .../models/AllOfWithSingleRef.ts | 2 +- .../snakecase-discriminator/models/Animal.ts | 4 +-- .../models/ArrayOfArrayOfNumberOnly.ts | 2 +- .../models/ArrayOfNumberOnly.ts | 2 +- .../models/ArrayTest.ts | 2 +- .../models/Capitalization.ts | 2 +- .../snakecase-discriminator/models/Cat.ts | 2 +- .../models/Category.ts | 4 +-- .../models/ClassModel.ts | 2 +- .../snakecase-discriminator/models/Client.ts | 2 +- .../models/DeprecatedObject.ts | 2 +- .../snakecase-discriminator/models/Dog.ts | 2 +- .../models/EnumArrays.ts | 2 +- .../models/EnumTest.ts | 4 +-- .../models/FakeBigDecimalMap200Response.ts | 2 +- .../models/FileSchemaTestClass.ts | 2 +- .../snakecase-discriminator/models/Foo.ts | 2 +- .../models/FooGetDefaultResponse.ts | 2 +- .../models/FormatTest.ts | 10 +++---- .../models/HasOnlyReadOnly.ts | 2 +- .../models/HealthCheckResult.ts | 2 +- .../snakecase-discriminator/models/List.ts | 2 +- .../snakecase-discriminator/models/MapTest.ts | 2 +- ...dPropertiesAndAdditionalPropertiesClass.ts | 2 +- .../models/Model200Response.ts | 2 +- .../models/ModelApiResponse.ts | 2 +- .../models/ModelFile.ts | 2 +- .../snakecase-discriminator/models/Name.ts | 4 +-- .../models/NullableClass.ts | 2 +- .../models/NumberOnly.ts | 2 +- .../models/ObjectWithDeprecatedFields.ts | 2 +- .../snakecase-discriminator/models/Order.ts | 2 +- .../models/OuterComposite.ts | 2 +- .../models/OuterObjectWithEnumProperty.ts | 4 +-- .../snakecase-discriminator/models/Pet.ts | 6 ++-- .../models/ReadOnlyFirst.ts | 2 +- .../snakecase-discriminator/models/Return.ts | 2 +- .../models/SpecialModelName.ts | 2 +- .../snakecase-discriminator/models/Tag.ts | 2 +- .../snakecase-discriminator/models/User.ts | 2 +- .../builds/with-interfaces/models/Category.ts | 2 +- .../models/ModelApiResponse.ts | 2 +- .../builds/with-interfaces/models/Order.ts | 2 +- .../builds/with-interfaces/models/Pet.ts | 6 ++-- .../builds/with-interfaces/models/Tag.ts | 2 +- .../builds/with-interfaces/models/User.ts | 2 +- .../with-npm-version/src/models/Category.ts | 2 +- .../src/models/ModelApiResponse.ts | 2 +- .../with-npm-version/src/models/Order.ts | 2 +- .../builds/with-npm-version/src/models/Pet.ts | 6 ++-- .../builds/with-npm-version/src/models/Tag.ts | 2 +- .../with-npm-version/src/models/User.ts | 2 +- .../models/EnumPatternObject.ts | 2 +- .../FakeEnumRequestGetInline200Response.ts | 2 +- 149 files changed, 216 insertions(+), 216 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache index 8e7d0344cd4a..0228aa5374e1 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache @@ -20,10 +20,10 @@ import { {{modelName}}FromJSONTyped } from './{{modelName}}{{importFileExtension /** * Check if a given object implements the {{classname}} interface. */ -export function instanceOf{{classname}}(value: object): boolean { +export function instanceOf{{classname}}(value: object): value is {{classname}} { {{#vars}} {{#required}} - if (!('{{name}}' in value)) return false; + if (!('{{name}}' in value) || value['{{name}}'] === undefined) return false; {{/required}} {{/vars}} return true; diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Club.ts b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Club.ts index 5e7c7f7f972f..6f935b2048d8 100644 --- a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Club.ts +++ b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Club.ts @@ -37,7 +37,7 @@ export interface Club { /** * Check if a given object implements the Club interface. */ -export function instanceOfClub(value: object): boolean { +export function instanceOfClub(value: object): value is Club { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Owner.ts b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Owner.ts index 50e770a7d3f8..58df8cbac491 100644 --- a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Owner.ts +++ b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Owner.ts @@ -30,7 +30,7 @@ export interface Owner { /** * Check if a given object implements the Owner interface. */ -export function instanceOfOwner(value: object): boolean { +export function instanceOfOwner(value: object): value is Owner { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/models/Club.ts b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/models/Club.ts index d61b559fea2a..c35b4f285e3f 100644 --- a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/models/Club.ts +++ b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/models/Club.ts @@ -37,7 +37,7 @@ export interface Club { /** * Check if a given object implements the Club interface. */ -export function instanceOfClub(value: object): boolean { +export function instanceOfClub(value: object): value is Club { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/models/Owner.ts b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/models/Owner.ts index 50e770a7d3f8..58df8cbac491 100644 --- a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/models/Owner.ts +++ b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/models/Owner.ts @@ -30,7 +30,7 @@ export interface Owner { /** * Check if a given object implements the Owner interface. */ -export function instanceOfOwner(value: object): boolean { +export function instanceOfOwner(value: object): value is Owner { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AdditionalPropertiesClass.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AdditionalPropertiesClass.ts index f0c934a942c6..a83efbc1155a 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AdditionalPropertiesClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AdditionalPropertiesClass.ts @@ -36,7 +36,7 @@ export interface AdditionalPropertiesClass { /** * Check if a given object implements the AdditionalPropertiesClass interface. */ -export function instanceOfAdditionalPropertiesClass(value: object): boolean { +export function instanceOfAdditionalPropertiesClass(value: object): value is AdditionalPropertiesClass { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AllOfWithSingleRef.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AllOfWithSingleRef.ts index 8f9802529e4b..2b247b983ffb 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AllOfWithSingleRef.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AllOfWithSingleRef.ts @@ -43,7 +43,7 @@ export interface AllOfWithSingleRef { /** * Check if a given object implements the AllOfWithSingleRef interface. */ -export function instanceOfAllOfWithSingleRef(value: object): boolean { +export function instanceOfAllOfWithSingleRef(value: object): value is AllOfWithSingleRef { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Animal.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Animal.ts index a5f85d1cc610..236ba544d0d8 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Animal.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Animal.ts @@ -38,8 +38,8 @@ export interface Animal { /** * Check if a given object implements the Animal interface. */ -export function instanceOfAnimal(value: object): boolean { - if (!('className' in value)) return false; +export function instanceOfAnimal(value: object): value is Animal { + if (!('className' in value) || value['className'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayOfArrayOfNumberOnly.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayOfArrayOfNumberOnly.ts index 6e4c4ac139c3..dbffd74a5723 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayOfArrayOfNumberOnly.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayOfArrayOfNumberOnly.ts @@ -30,7 +30,7 @@ export interface ArrayOfArrayOfNumberOnly { /** * Check if a given object implements the ArrayOfArrayOfNumberOnly interface. */ -export function instanceOfArrayOfArrayOfNumberOnly(value: object): boolean { +export function instanceOfArrayOfArrayOfNumberOnly(value: object): value is ArrayOfArrayOfNumberOnly { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayOfNumberOnly.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayOfNumberOnly.ts index 4c0e2e98805b..8029e9dd15bc 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayOfNumberOnly.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayOfNumberOnly.ts @@ -30,7 +30,7 @@ export interface ArrayOfNumberOnly { /** * Check if a given object implements the ArrayOfNumberOnly interface. */ -export function instanceOfArrayOfNumberOnly(value: object): boolean { +export function instanceOfArrayOfNumberOnly(value: object): value is ArrayOfNumberOnly { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayTest.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayTest.ts index 2cdb8f33fa6f..fefc0e842b6f 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayTest.ts @@ -49,7 +49,7 @@ export interface ArrayTest { /** * Check if a given object implements the ArrayTest interface. */ -export function instanceOfArrayTest(value: object): boolean { +export function instanceOfArrayTest(value: object): value is ArrayTest { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Capitalization.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Capitalization.ts index 1d7e59d6099d..f9f38b2ed71f 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Capitalization.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Capitalization.ts @@ -61,7 +61,7 @@ export interface Capitalization { /** * Check if a given object implements the Capitalization interface. */ -export function instanceOfCapitalization(value: object): boolean { +export function instanceOfCapitalization(value: object): value is Capitalization { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Cat.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Cat.ts index 3bc2bd8cdb13..05ffd9e8fab5 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Cat.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Cat.ts @@ -37,7 +37,7 @@ export interface Cat extends Animal { /** * Check if a given object implements the Cat interface. */ -export function instanceOfCat(value: object): boolean { +export function instanceOfCat(value: object): value is Cat { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Category.ts index e571880c8e1e..640b1883c524 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Category.ts @@ -36,8 +36,8 @@ export interface Category { /** * Check if a given object implements the Category interface. */ -export function instanceOfCategory(value: object): boolean { - if (!('name' in value)) return false; +export function instanceOfCategory(value: object): value is Category { + if (!('name' in value) || value['name'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ChildWithNullable.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ChildWithNullable.ts index 2ed247a45410..24167b77a66b 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ChildWithNullable.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ChildWithNullable.ts @@ -39,7 +39,7 @@ export interface ChildWithNullable extends ParentWithNullable { /** * Check if a given object implements the ChildWithNullable interface. */ -export function instanceOfChildWithNullable(value: object): boolean { +export function instanceOfChildWithNullable(value: object): value is ChildWithNullable { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ClassModel.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ClassModel.ts index 6d9ad88c1c55..1789763aaecc 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ClassModel.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ClassModel.ts @@ -30,7 +30,7 @@ export interface ClassModel { /** * Check if a given object implements the ClassModel interface. */ -export function instanceOfClassModel(value: object): boolean { +export function instanceOfClassModel(value: object): value is ClassModel { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Client.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Client.ts index 807cd0777308..21c3a1f3b798 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Client.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Client.ts @@ -30,7 +30,7 @@ export interface Client { /** * Check if a given object implements the Client interface. */ -export function instanceOfClient(value: object): boolean { +export function instanceOfClient(value: object): value is Client { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/DeprecatedObject.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/DeprecatedObject.ts index 8eab37673066..38ae523f5b96 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/DeprecatedObject.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/DeprecatedObject.ts @@ -30,7 +30,7 @@ export interface DeprecatedObject { /** * Check if a given object implements the DeprecatedObject interface. */ -export function instanceOfDeprecatedObject(value: object): boolean { +export function instanceOfDeprecatedObject(value: object): value is DeprecatedObject { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Dog.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Dog.ts index 921e17cb803f..5df4d5123a82 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Dog.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Dog.ts @@ -37,7 +37,7 @@ export interface Dog extends Animal { /** * Check if a given object implements the Dog interface. */ -export function instanceOfDog(value: object): boolean { +export function instanceOfDog(value: object): value is Dog { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumArrays.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumArrays.ts index aa7200c92542..ddff5eeb796e 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumArrays.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumArrays.ts @@ -56,7 +56,7 @@ export type EnumArraysArrayEnumEnum = typeof EnumArraysArrayEnumEnum[keyof typeo /** * Check if a given object implements the EnumArrays interface. */ -export function instanceOfEnumArrays(value: object): boolean { +export function instanceOfEnumArrays(value: object): value is EnumArrays { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumTest.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumTest.ts index caeccfc55388..b4ef265fd2d2 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumTest.ts @@ -137,8 +137,8 @@ export type EnumTestEnumNumberEnum = typeof EnumTestEnumNumberEnum[keyof typeof /** * Check if a given object implements the EnumTest interface. */ -export function instanceOfEnumTest(value: object): boolean { - if (!('enumStringRequired' in value)) return false; +export function instanceOfEnumTest(value: object): value is EnumTest { + if (!('enumStringRequired' in value) || value['enumStringRequired'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FakeBigDecimalMap200Response.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FakeBigDecimalMap200Response.ts index 732ed05b62a0..dc65ebf50f77 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FakeBigDecimalMap200Response.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FakeBigDecimalMap200Response.ts @@ -36,7 +36,7 @@ export interface FakeBigDecimalMap200Response { /** * Check if a given object implements the FakeBigDecimalMap200Response interface. */ -export function instanceOfFakeBigDecimalMap200Response(value: object): boolean { +export function instanceOfFakeBigDecimalMap200Response(value: object): value is FakeBigDecimalMap200Response { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FileSchemaTestClass.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FileSchemaTestClass.ts index 25bf3ba4dbf1..9da5b93a1a20 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FileSchemaTestClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FileSchemaTestClass.ts @@ -36,7 +36,7 @@ export interface FileSchemaTestClass { /** * Check if a given object implements the FileSchemaTestClass interface. */ -export function instanceOfFileSchemaTestClass(value: object): boolean { +export function instanceOfFileSchemaTestClass(value: object): value is FileSchemaTestClass { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Foo.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Foo.ts index feb5e47da049..94845a52698d 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Foo.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Foo.ts @@ -30,7 +30,7 @@ export interface Foo { /** * Check if a given object implements the Foo interface. */ -export function instanceOfFoo(value: object): boolean { +export function instanceOfFoo(value: object): value is Foo { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FooGetDefaultResponse.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FooGetDefaultResponse.ts index b834ab550db6..86af8d7e7cc0 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FooGetDefaultResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FooGetDefaultResponse.ts @@ -37,7 +37,7 @@ export interface FooGetDefaultResponse { /** * Check if a given object implements the FooGetDefaultResponse interface. */ -export function instanceOfFooGetDefaultResponse(value: object): boolean { +export function instanceOfFooGetDefaultResponse(value: object): value is FooGetDefaultResponse { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FormatTest.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FormatTest.ts index f2113709741f..328ec809ee95 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FormatTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FormatTest.ts @@ -127,11 +127,11 @@ export interface FormatTest { /** * Check if a given object implements the FormatTest interface. */ -export function instanceOfFormatTest(value: object): boolean { - if (!('number' in value)) return false; - if (!('_byte' in value)) return false; - if (!('date' in value)) return false; - if (!('password' in value)) return false; +export function instanceOfFormatTest(value: object): value is FormatTest { + if (!('number' in value) || value['number'] === undefined) return false; + if (!('_byte' in value) || value['_byte'] === undefined) return false; + if (!('date' in value) || value['date'] === undefined) return false; + if (!('password' in value) || value['password'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/HasOnlyReadOnly.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/HasOnlyReadOnly.ts index 82e1d7235e13..db19db8f72cf 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/HasOnlyReadOnly.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/HasOnlyReadOnly.ts @@ -36,7 +36,7 @@ export interface HasOnlyReadOnly { /** * Check if a given object implements the HasOnlyReadOnly interface. */ -export function instanceOfHasOnlyReadOnly(value: object): boolean { +export function instanceOfHasOnlyReadOnly(value: object): value is HasOnlyReadOnly { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/HealthCheckResult.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/HealthCheckResult.ts index 83a0cf52ee15..450b2c25043b 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/HealthCheckResult.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/HealthCheckResult.ts @@ -30,7 +30,7 @@ export interface HealthCheckResult { /** * Check if a given object implements the HealthCheckResult interface. */ -export function instanceOfHealthCheckResult(value: object): boolean { +export function instanceOfHealthCheckResult(value: object): value is HealthCheckResult { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/List.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/List.ts index 5513deda0790..2b979862b769 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/List.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/List.ts @@ -30,7 +30,7 @@ export interface List { /** * Check if a given object implements the List interface. */ -export function instanceOfList(value: object): boolean { +export function instanceOfList(value: object): value is List { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MapTest.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MapTest.ts index 0ba03f9a901b..7a2a4b27fef8 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MapTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MapTest.ts @@ -59,7 +59,7 @@ export type MapTestMapOfEnumStringEnum = typeof MapTestMapOfEnumStringEnum[keyof /** * Check if a given object implements the MapTest interface. */ -export function instanceOfMapTest(value: object): boolean { +export function instanceOfMapTest(value: object): value is MapTest { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MixedPropertiesAndAdditionalPropertiesClass.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MixedPropertiesAndAdditionalPropertiesClass.ts index 156ccc8a342d..599422a3417b 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MixedPropertiesAndAdditionalPropertiesClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MixedPropertiesAndAdditionalPropertiesClass.ts @@ -49,7 +49,7 @@ export interface MixedPropertiesAndAdditionalPropertiesClass { /** * Check if a given object implements the MixedPropertiesAndAdditionalPropertiesClass interface. */ -export function instanceOfMixedPropertiesAndAdditionalPropertiesClass(value: object): boolean { +export function instanceOfMixedPropertiesAndAdditionalPropertiesClass(value: object): value is MixedPropertiesAndAdditionalPropertiesClass { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Model200Response.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Model200Response.ts index 22570495bd69..31254e14b766 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Model200Response.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Model200Response.ts @@ -36,7 +36,7 @@ export interface Model200Response { /** * Check if a given object implements the Model200Response interface. */ -export function instanceOfModel200Response(value: object): boolean { +export function instanceOfModel200Response(value: object): value is Model200Response { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ModelApiResponse.ts index 7116a59f8d22..bf92ceff548f 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ModelApiResponse.ts @@ -42,7 +42,7 @@ export interface ModelApiResponse { /** * Check if a given object implements the ModelApiResponse interface. */ -export function instanceOfModelApiResponse(value: object): boolean { +export function instanceOfModelApiResponse(value: object): value is ModelApiResponse { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ModelFile.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ModelFile.ts index dc08a2f1474a..c54577e4fc06 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ModelFile.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ModelFile.ts @@ -30,7 +30,7 @@ export interface ModelFile { /** * Check if a given object implements the ModelFile interface. */ -export function instanceOfModelFile(value: object): boolean { +export function instanceOfModelFile(value: object): value is ModelFile { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Name.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Name.ts index 9b861d6d4d14..dbcf899e8541 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Name.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Name.ts @@ -48,8 +48,8 @@ export interface Name { /** * Check if a given object implements the Name interface. */ -export function instanceOfName(value: object): boolean { - if (!('name' in value)) return false; +export function instanceOfName(value: object): value is Name { + if (!('name' in value) || value['name'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NullableClass.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NullableClass.ts index b64cd7d8f452..2fbcea7c6eac 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NullableClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NullableClass.ts @@ -97,7 +97,7 @@ export interface NullableClass { /** * Check if a given object implements the NullableClass interface. */ -export function instanceOfNullableClass(value: object): boolean { +export function instanceOfNullableClass(value: object): value is NullableClass { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NumberOnly.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NumberOnly.ts index 155afb118e43..c778f996c1a2 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NumberOnly.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NumberOnly.ts @@ -30,7 +30,7 @@ export interface NumberOnly { /** * Check if a given object implements the NumberOnly interface. */ -export function instanceOfNumberOnly(value: object): boolean { +export function instanceOfNumberOnly(value: object): value is NumberOnly { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ObjectWithDeprecatedFields.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ObjectWithDeprecatedFields.ts index d24ea8fc197e..99c4b488c489 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ObjectWithDeprecatedFields.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ObjectWithDeprecatedFields.ts @@ -58,7 +58,7 @@ export interface ObjectWithDeprecatedFields { /** * Check if a given object implements the ObjectWithDeprecatedFields interface. */ -export function instanceOfObjectWithDeprecatedFields(value: object): boolean { +export function instanceOfObjectWithDeprecatedFields(value: object): value is ObjectWithDeprecatedFields { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Order.ts index 8921894971d6..7b83e804baad 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Order.ts @@ -72,7 +72,7 @@ export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnu /** * Check if a given object implements the Order interface. */ -export function instanceOfOrder(value: object): boolean { +export function instanceOfOrder(value: object): value is Order { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterComposite.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterComposite.ts index 49d8ad5cc5b1..c965a360d04b 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterComposite.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterComposite.ts @@ -42,7 +42,7 @@ export interface OuterComposite { /** * Check if a given object implements the OuterComposite interface. */ -export function instanceOfOuterComposite(value: object): boolean { +export function instanceOfOuterComposite(value: object): value is OuterComposite { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterObjectWithEnumProperty.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterObjectWithEnumProperty.ts index 3990064c3484..c8ca1734039f 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterObjectWithEnumProperty.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterObjectWithEnumProperty.ts @@ -37,8 +37,8 @@ export interface OuterObjectWithEnumProperty { /** * Check if a given object implements the OuterObjectWithEnumProperty interface. */ -export function instanceOfOuterObjectWithEnumProperty(value: object): boolean { - if (!('value' in value)) return false; +export function instanceOfOuterObjectWithEnumProperty(value: object): value is OuterObjectWithEnumProperty { + if (!('value' in value) || value['value'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ParentWithNullable.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ParentWithNullable.ts index c549674ec4a2..81195930614e 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ParentWithNullable.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ParentWithNullable.ts @@ -47,7 +47,7 @@ export type ParentWithNullableTypeEnum = typeof ParentWithNullableTypeEnum[keyof /** * Check if a given object implements the ParentWithNullable interface. */ -export function instanceOfParentWithNullable(value: object): boolean { +export function instanceOfParentWithNullable(value: object): value is ParentWithNullable { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Pet.ts index 1f29621cb3b4..f2ad3c1ee466 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Pet.ts @@ -85,9 +85,9 @@ export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum]; /** * Check if a given object implements the Pet interface. */ -export function instanceOfPet(value: object): boolean { - if (!('name' in value)) return false; - if (!('photoUrls' in value)) return false; +export function instanceOfPet(value: object): value is Pet { + if (!('name' in value) || value['name'] === undefined) return false; + if (!('photoUrls' in value) || value['photoUrls'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ReadOnlyFirst.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ReadOnlyFirst.ts index f1f5a01a89b6..9bd46c432fca 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ReadOnlyFirst.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ReadOnlyFirst.ts @@ -36,7 +36,7 @@ export interface ReadOnlyFirst { /** * Check if a given object implements the ReadOnlyFirst interface. */ -export function instanceOfReadOnlyFirst(value: object): boolean { +export function instanceOfReadOnlyFirst(value: object): value is ReadOnlyFirst { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Return.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Return.ts index 68b15542cbbd..3de8fb2d62be 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Return.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Return.ts @@ -30,7 +30,7 @@ export interface Return { /** * Check if a given object implements the Return interface. */ -export function instanceOfReturn(value: object): boolean { +export function instanceOfReturn(value: object): value is Return { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/SpecialModelName.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/SpecialModelName.ts index b302e6f03627..34edcaa2f004 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/SpecialModelName.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/SpecialModelName.ts @@ -30,7 +30,7 @@ export interface SpecialModelName { /** * Check if a given object implements the SpecialModelName interface. */ -export function instanceOfSpecialModelName(value: object): boolean { +export function instanceOfSpecialModelName(value: object): value is SpecialModelName { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Tag.ts index 4ae4af399fd8..f0ecd59d5ba2 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Tag.ts @@ -36,7 +36,7 @@ export interface Tag { /** * Check if a given object implements the Tag interface. */ -export function instanceOfTag(value: object): boolean { +export function instanceOfTag(value: object): value is Tag { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/TestInlineFreeformAdditionalPropertiesRequest.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/TestInlineFreeformAdditionalPropertiesRequest.ts index acc16c94f495..cfe6fac4f43f 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/TestInlineFreeformAdditionalPropertiesRequest.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/TestInlineFreeformAdditionalPropertiesRequest.ts @@ -31,7 +31,7 @@ export interface TestInlineFreeformAdditionalPropertiesRequest { /** * Check if a given object implements the TestInlineFreeformAdditionalPropertiesRequest interface. */ -export function instanceOfTestInlineFreeformAdditionalPropertiesRequest(value: object): boolean { +export function instanceOfTestInlineFreeformAdditionalPropertiesRequest(value: object): value is TestInlineFreeformAdditionalPropertiesRequest { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/User.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/User.ts index c85ea3d6ed63..2028044d626c 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/User.ts @@ -72,7 +72,7 @@ export interface User { /** * Check if a given object implements the User interface. */ -export function instanceOfUser(value: object): boolean { +export function instanceOfUser(value: object): value is User { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/default/models/Category.ts index 19e40eaf4b86..54f256e339f5 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Category.ts @@ -36,7 +36,7 @@ export interface Category { /** * Check if a given object implements the Category interface. */ -export function instanceOfCategory(value: object): boolean { +export function instanceOfCategory(value: object): value is Category { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/default/models/ModelApiResponse.ts index 4496efe73f05..bc250bd002cb 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/ModelApiResponse.ts @@ -42,7 +42,7 @@ export interface ModelApiResponse { /** * Check if a given object implements the ModelApiResponse interface. */ -export function instanceOfModelApiResponse(value: object): boolean { +export function instanceOfModelApiResponse(value: object): value is ModelApiResponse { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/default/models/Order.ts index 948cda435c8a..f1a3a4bb0f0a 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Order.ts @@ -72,7 +72,7 @@ export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnu /** * Check if a given object implements the Order interface. */ -export function instanceOfOrder(value: object): boolean { +export function instanceOfOrder(value: object): value is Order { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/default/models/Pet.ts index 3c60d980598b..476b11aa0efc 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Pet.ts @@ -85,9 +85,9 @@ export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum]; /** * Check if a given object implements the Pet interface. */ -export function instanceOfPet(value: object): boolean { - if (!('name' in value)) return false; - if (!('photoUrls' in value)) return false; +export function instanceOfPet(value: object): value is Pet { + if (!('name' in value) || value['name'] === undefined) return false; + if (!('photoUrls' in value) || value['photoUrls'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/default/models/Tag.ts index 0a5bdbdde07c..fd877416ade1 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Tag.ts @@ -36,7 +36,7 @@ export interface Tag { /** * Check if a given object implements the Tag interface. */ -export function instanceOfTag(value: object): boolean { +export function instanceOfTag(value: object): value is Tag { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/default/models/User.ts b/samples/client/petstore/typescript-fetch/builds/default/models/User.ts index 3924497622f9..149be73b9ffc 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/User.ts @@ -72,7 +72,7 @@ export interface User { /** * Check if a given object implements the User interface. */ -export function instanceOfUser(value: object): boolean { +export function instanceOfUser(value: object): value is User { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/enum/models/EnumPatternObject.ts b/samples/client/petstore/typescript-fetch/builds/enum/models/EnumPatternObject.ts index a902fb9c9af3..8f61f66faaa1 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/models/EnumPatternObject.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/models/EnumPatternObject.ts @@ -61,7 +61,7 @@ export interface EnumPatternObject { /** * Check if a given object implements the EnumPatternObject interface. */ -export function instanceOfEnumPatternObject(value: object): boolean { +export function instanceOfEnumPatternObject(value: object): value is EnumPatternObject { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/enum/models/FakeEnumRequestGetInline200Response.ts b/samples/client/petstore/typescript-fetch/builds/enum/models/FakeEnumRequestGetInline200Response.ts index 0e53bcfd09d6..644637105ce5 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/models/FakeEnumRequestGetInline200Response.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/models/FakeEnumRequestGetInline200Response.ts @@ -90,7 +90,7 @@ export type FakeEnumRequestGetInline200ResponseNullableNumberEnumEnum = typeof F /** * Check if a given object implements the FakeEnumRequestGetInline200Response interface. */ -export function instanceOfFakeEnumRequestGetInline200Response(value: object): boolean { +export function instanceOfFakeEnumRequestGetInline200Response(value: object): value is FakeEnumRequestGetInline200Response { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Category.ts index 19e40eaf4b86..54f256e339f5 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Category.ts @@ -36,7 +36,7 @@ export interface Category { /** * Check if a given object implements the Category interface. */ -export function instanceOfCategory(value: object): boolean { +export function instanceOfCategory(value: object): value is Category { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/ModelApiResponse.ts index 4496efe73f05..bc250bd002cb 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/ModelApiResponse.ts @@ -42,7 +42,7 @@ export interface ModelApiResponse { /** * Check if a given object implements the ModelApiResponse interface. */ -export function instanceOfModelApiResponse(value: object): boolean { +export function instanceOfModelApiResponse(value: object): value is ModelApiResponse { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Order.ts index 948cda435c8a..f1a3a4bb0f0a 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Order.ts @@ -72,7 +72,7 @@ export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnu /** * Check if a given object implements the Order interface. */ -export function instanceOfOrder(value: object): boolean { +export function instanceOfOrder(value: object): value is Order { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Pet.ts index 3c60d980598b..476b11aa0efc 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Pet.ts @@ -85,9 +85,9 @@ export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum]; /** * Check if a given object implements the Pet interface. */ -export function instanceOfPet(value: object): boolean { - if (!('name' in value)) return false; - if (!('photoUrls' in value)) return false; +export function instanceOfPet(value: object): value is Pet { + if (!('name' in value) || value['name'] === undefined) return false; + if (!('photoUrls' in value) || value['photoUrls'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Tag.ts index 0a5bdbdde07c..fd877416ade1 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Tag.ts @@ -36,7 +36,7 @@ export interface Tag { /** * Check if a given object implements the Tag interface. */ -export function instanceOfTag(value: object): boolean { +export function instanceOfTag(value: object): value is Tag { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/User.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/User.ts index 3924497622f9..149be73b9ffc 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/User.ts @@ -72,7 +72,7 @@ export interface User { /** * Check if a given object implements the User interface. */ -export function instanceOfUser(value: object): boolean { +export function instanceOfUser(value: object): value is User { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Category.ts index 19e40eaf4b86..54f256e339f5 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Category.ts @@ -36,7 +36,7 @@ export interface Category { /** * Check if a given object implements the Category interface. */ -export function instanceOfCategory(value: object): boolean { +export function instanceOfCategory(value: object): value is Category { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/ModelApiResponse.ts index 4496efe73f05..bc250bd002cb 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/ModelApiResponse.ts @@ -42,7 +42,7 @@ export interface ModelApiResponse { /** * Check if a given object implements the ModelApiResponse interface. */ -export function instanceOfModelApiResponse(value: object): boolean { +export function instanceOfModelApiResponse(value: object): value is ModelApiResponse { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Order.ts index 948cda435c8a..f1a3a4bb0f0a 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Order.ts @@ -72,7 +72,7 @@ export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnu /** * Check if a given object implements the Order interface. */ -export function instanceOfOrder(value: object): boolean { +export function instanceOfOrder(value: object): value is Order { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Pet.ts index 3c60d980598b..476b11aa0efc 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Pet.ts @@ -85,9 +85,9 @@ export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum]; /** * Check if a given object implements the Pet interface. */ -export function instanceOfPet(value: object): boolean { - if (!('name' in value)) return false; - if (!('photoUrls' in value)) return false; +export function instanceOfPet(value: object): value is Pet { + if (!('name' in value) || value['name'] === undefined) return false; + if (!('photoUrls' in value) || value['photoUrls'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Tag.ts index 0a5bdbdde07c..fd877416ade1 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Tag.ts @@ -36,7 +36,7 @@ export interface Tag { /** * Check if a given object implements the Tag interface. */ -export function instanceOfTag(value: object): boolean { +export function instanceOfTag(value: object): value is Tag { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/User.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/User.ts index 3924497622f9..149be73b9ffc 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/User.ts @@ -72,7 +72,7 @@ export interface User { /** * Check if a given object implements the User interface. */ -export function instanceOfUser(value: object): boolean { +export function instanceOfUser(value: object): value is User { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Category.ts index 19e40eaf4b86..54f256e339f5 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Category.ts @@ -36,7 +36,7 @@ export interface Category { /** * Check if a given object implements the Category interface. */ -export function instanceOfCategory(value: object): boolean { +export function instanceOfCategory(value: object): value is Category { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/ModelApiResponse.ts index 4496efe73f05..bc250bd002cb 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/ModelApiResponse.ts @@ -42,7 +42,7 @@ export interface ModelApiResponse { /** * Check if a given object implements the ModelApiResponse interface. */ -export function instanceOfModelApiResponse(value: object): boolean { +export function instanceOfModelApiResponse(value: object): value is ModelApiResponse { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Order.ts index 948cda435c8a..f1a3a4bb0f0a 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Order.ts @@ -72,7 +72,7 @@ export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnu /** * Check if a given object implements the Order interface. */ -export function instanceOfOrder(value: object): boolean { +export function instanceOfOrder(value: object): value is Order { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Pet.ts index 3c60d980598b..476b11aa0efc 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Pet.ts @@ -85,9 +85,9 @@ export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum]; /** * Check if a given object implements the Pet interface. */ -export function instanceOfPet(value: object): boolean { - if (!('name' in value)) return false; - if (!('photoUrls' in value)) return false; +export function instanceOfPet(value: object): value is Pet { + if (!('name' in value) || value['name'] === undefined) return false; + if (!('photoUrls' in value) || value['photoUrls'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Tag.ts index 0a5bdbdde07c..fd877416ade1 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Tag.ts @@ -36,7 +36,7 @@ export interface Tag { /** * Check if a given object implements the Tag interface. */ -export function instanceOfTag(value: object): boolean { +export function instanceOfTag(value: object): value is Tag { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/User.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/User.ts index 3924497622f9..149be73b9ffc 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/User.ts @@ -72,7 +72,7 @@ export interface User { /** * Check if a given object implements the User interface. */ -export function instanceOfUser(value: object): boolean { +export function instanceOfUser(value: object): value is User { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Category.ts index 19e40eaf4b86..54f256e339f5 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Category.ts @@ -36,7 +36,7 @@ export interface Category { /** * Check if a given object implements the Category interface. */ -export function instanceOfCategory(value: object): boolean { +export function instanceOfCategory(value: object): value is Category { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DefaultMetaOnlyResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DefaultMetaOnlyResponse.ts index 72d0569f4ccd..9e3a2d63c543 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DefaultMetaOnlyResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DefaultMetaOnlyResponse.ts @@ -37,8 +37,8 @@ export interface DefaultMetaOnlyResponse { /** * Check if a given object implements the DefaultMetaOnlyResponse interface. */ -export function instanceOfDefaultMetaOnlyResponse(value: object): boolean { - if (!('meta' in value)) return false; +export function instanceOfDefaultMetaOnlyResponse(value: object): value is DefaultMetaOnlyResponse { + if (!('meta' in value) || value['meta'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByStatusResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByStatusResponse.ts index 8101bbc1d26e..7f4307dbd771 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByStatusResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByStatusResponse.ts @@ -49,8 +49,8 @@ export interface FindPetsByStatusResponse { /** * Check if a given object implements the FindPetsByStatusResponse interface. */ -export function instanceOfFindPetsByStatusResponse(value: object): boolean { - if (!('meta' in value)) return false; +export function instanceOfFindPetsByStatusResponse(value: object): value is FindPetsByStatusResponse { + if (!('meta' in value) || value['meta'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByUserResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByUserResponse.ts index 83b0d3308f0f..31e86f68d609 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByUserResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByUserResponse.ts @@ -49,8 +49,8 @@ export interface FindPetsByUserResponse { /** * Check if a given object implements the FindPetsByUserResponse interface. */ -export function instanceOfFindPetsByUserResponse(value: object): boolean { - if (!('meta' in value)) return false; +export function instanceOfFindPetsByUserResponse(value: object): value is FindPetsByUserResponse { + if (!('meta' in value) || value['meta'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorPermissionsResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorPermissionsResponse.ts index e25682be1f59..c001a843b0e5 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorPermissionsResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorPermissionsResponse.ts @@ -43,8 +43,8 @@ export interface GetBehaviorPermissionsResponse { /** * Check if a given object implements the GetBehaviorPermissionsResponse interface. */ -export function instanceOfGetBehaviorPermissionsResponse(value: object): boolean { - if (!('meta' in value)) return false; +export function instanceOfGetBehaviorPermissionsResponse(value: object): value is GetBehaviorPermissionsResponse { + if (!('meta' in value) || value['meta'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorTypeResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorTypeResponse.ts index 4f00ef278937..5de27f58461d 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorTypeResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorTypeResponse.ts @@ -49,8 +49,8 @@ export interface GetBehaviorTypeResponse { /** * Check if a given object implements the GetBehaviorTypeResponse interface. */ -export function instanceOfGetBehaviorTypeResponse(value: object): boolean { - if (!('meta' in value)) return false; +export function instanceOfGetBehaviorTypeResponse(value: object): value is GetBehaviorTypeResponse { + if (!('meta' in value) || value['meta'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetMatchingPartsResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetMatchingPartsResponse.ts index aef34f1254fc..af60c4b351a0 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetMatchingPartsResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetMatchingPartsResponse.ts @@ -49,8 +49,8 @@ export interface GetMatchingPartsResponse { /** * Check if a given object implements the GetMatchingPartsResponse interface. */ -export function instanceOfGetMatchingPartsResponse(value: object): boolean { - if (!('meta' in value)) return false; +export function instanceOfGetMatchingPartsResponse(value: object): value is GetMatchingPartsResponse { + if (!('meta' in value) || value['meta'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetPartTypeResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetPartTypeResponse.ts index 2b35d9f88880..16ec39476732 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetPartTypeResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetPartTypeResponse.ts @@ -49,8 +49,8 @@ export interface GetPetPartTypeResponse { /** * Check if a given object implements the GetPetPartTypeResponse interface. */ -export function instanceOfGetPetPartTypeResponse(value: object): boolean { - if (!('meta' in value)) return false; +export function instanceOfGetPetPartTypeResponse(value: object): value is GetPetPartTypeResponse { + if (!('meta' in value) || value['meta'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ItemId.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ItemId.ts index 5c2c26352428..bad63a3c68c5 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ItemId.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ItemId.ts @@ -36,9 +36,9 @@ export interface ItemId { /** * Check if a given object implements the ItemId interface. */ -export function instanceOfItemId(value: object): boolean { - if (!('id' in value)) return false; - if (!('type' in value)) return false; +export function instanceOfItemId(value: object): value is ItemId { + if (!('id' in value) || value['id'] === undefined) return false; + if (!('type' in value) || value['type'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/MatchingParts.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/MatchingParts.ts index 6c27dd2e8019..7f501316a407 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/MatchingParts.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/MatchingParts.ts @@ -43,9 +43,9 @@ export interface MatchingParts { /** * Check if a given object implements the MatchingParts interface. */ -export function instanceOfMatchingParts(value: object): boolean { - if (!('connected' in value)) return false; - if (!('related' in value)) return false; +export function instanceOfMatchingParts(value: object): value is MatchingParts { + if (!('connected' in value) || value['connected'] === undefined) return false; + if (!('related' in value) || value['related'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelApiResponse.ts index 4496efe73f05..bc250bd002cb 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelApiResponse.ts @@ -42,7 +42,7 @@ export interface ModelApiResponse { /** * Check if a given object implements the ModelApiResponse interface. */ -export function instanceOfModelApiResponse(value: object): boolean { +export function instanceOfModelApiResponse(value: object): value is ModelApiResponse { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelError.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelError.ts index 75714ef92cce..d5b17c2160c2 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelError.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelError.ts @@ -55,8 +55,8 @@ export interface ModelError { /** * Check if a given object implements the ModelError interface. */ -export function instanceOfModelError(value: object): boolean { - if (!('type' in value)) return false; +export function instanceOfModelError(value: object): value is ModelError { + if (!('type' in value) || value['type'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Order.ts index 948cda435c8a..f1a3a4bb0f0a 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Order.ts @@ -72,7 +72,7 @@ export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnu /** * Check if a given object implements the Order interface. */ -export function instanceOfOrder(value: object): boolean { +export function instanceOfOrder(value: object): value is Order { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Part.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Part.ts index 9d7ae4222138..07f345d28df0 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Part.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Part.ts @@ -36,9 +36,9 @@ export interface Part { /** * Check if a given object implements the Part interface. */ -export function instanceOfPart(value: object): boolean { - if (!('id' in value)) return false; - if (!('name' in value)) return false; +export function instanceOfPart(value: object): value is Part { + if (!('id' in value) || value['id'] === undefined) return false; + if (!('name' in value) || value['name'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Pet.ts index bc567b494366..35c173b55b36 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Pet.ts @@ -187,21 +187,21 @@ export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum]; /** * Check if a given object implements the Pet interface. */ -export function instanceOfPet(value: object): boolean { - if (!('id' in value)) return false; - if (!('otherFriendIds' in value)) return false; - if (!('friendAge' in value)) return false; - if (!('age' in value)) return false; - if (!('isHappy' in value)) return false; - if (!('isTall' in value)) return false; - if (!('category' in value)) return false; - if (!('name' in value)) return false; - if (!('photoUrls' in value)) return false; - if (!('warningStatus' in value)) return false; - if (!('alternateStatus' in value)) return false; - if (!('otherDepStatuses' in value)) return false; - if (!('tags' in value)) return false; - if (!('status' in value)) return false; +export function instanceOfPet(value: object): value is Pet { + if (!('id' in value) || value['id'] === undefined) return false; + if (!('otherFriendIds' in value) || value['otherFriendIds'] === undefined) return false; + if (!('friendAge' in value) || value['friendAge'] === undefined) return false; + if (!('age' in value) || value['age'] === undefined) return false; + if (!('isHappy' in value) || value['isHappy'] === undefined) return false; + if (!('isTall' in value) || value['isTall'] === undefined) return false; + if (!('category' in value) || value['category'] === undefined) return false; + if (!('name' in value) || value['name'] === undefined) return false; + if (!('photoUrls' in value) || value['photoUrls'] === undefined) return false; + if (!('warningStatus' in value) || value['warningStatus'] === undefined) return false; + if (!('alternateStatus' in value) || value['alternateStatus'] === undefined) return false; + if (!('otherDepStatuses' in value) || value['otherDepStatuses'] === undefined) return false; + if (!('tags' in value) || value['tags'] === undefined) return false; + if (!('status' in value) || value['status'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponse.ts index 400a5fa83e8d..8430854a46ce 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponse.ts @@ -43,8 +43,8 @@ export interface PetRegionsResponse { /** * Check if a given object implements the PetRegionsResponse interface. */ -export function instanceOfPetRegionsResponse(value: object): boolean { - if (!('meta' in value)) return false; +export function instanceOfPetRegionsResponse(value: object): value is PetRegionsResponse { + if (!('meta' in value) || value['meta'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ResponseMeta.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ResponseMeta.ts index 6b17720e996a..4584d592e7cc 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ResponseMeta.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ResponseMeta.ts @@ -99,8 +99,8 @@ export type ResponseMetaCodeEnum = typeof ResponseMetaCodeEnum[keyof typeof Resp /** * Check if a given object implements the ResponseMeta interface. */ -export function instanceOfResponseMeta(value: object): boolean { - if (!('code' in value)) return false; +export function instanceOfResponseMeta(value: object): value is ResponseMeta { + if (!('code' in value) || value['code'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Tag.ts index 0a5bdbdde07c..fd877416ade1 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Tag.ts @@ -36,7 +36,7 @@ export interface Tag { /** * Check if a given object implements the Tag interface. */ -export function instanceOfTag(value: object): boolean { +export function instanceOfTag(value: object): value is Tag { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/User.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/User.ts index c6cb145be14e..17092c2c5804 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/User.ts @@ -84,9 +84,9 @@ export interface User { /** * Check if a given object implements the User interface. */ -export function instanceOfUser(value: object): boolean { - if (!('id' in value)) return false; - if (!('subUser2' in value)) return false; +export function instanceOfUser(value: object): value is User { + if (!('id' in value) || value['id'] === undefined) return false; + if (!('subUser2' in value) || value['subUser2'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/AdditionalPropertiesClass.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/AdditionalPropertiesClass.ts index f0c934a942c6..a83efbc1155a 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/AdditionalPropertiesClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/AdditionalPropertiesClass.ts @@ -36,7 +36,7 @@ export interface AdditionalPropertiesClass { /** * Check if a given object implements the AdditionalPropertiesClass interface. */ -export function instanceOfAdditionalPropertiesClass(value: object): boolean { +export function instanceOfAdditionalPropertiesClass(value: object): value is AdditionalPropertiesClass { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/AllOfWithSingleRef.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/AllOfWithSingleRef.ts index 8f9802529e4b..2b247b983ffb 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/AllOfWithSingleRef.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/AllOfWithSingleRef.ts @@ -43,7 +43,7 @@ export interface AllOfWithSingleRef { /** * Check if a given object implements the AllOfWithSingleRef interface. */ -export function instanceOfAllOfWithSingleRef(value: object): boolean { +export function instanceOfAllOfWithSingleRef(value: object): value is AllOfWithSingleRef { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Animal.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Animal.ts index 5edd6e54feea..a49466dfac66 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Animal.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Animal.ts @@ -38,8 +38,8 @@ export interface Animal { /** * Check if a given object implements the Animal interface. */ -export function instanceOfAnimal(value: object): boolean { - if (!('className' in value)) return false; +export function instanceOfAnimal(value: object): value is Animal { + if (!('className' in value) || value['className'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayOfArrayOfNumberOnly.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayOfArrayOfNumberOnly.ts index 6e4c4ac139c3..dbffd74a5723 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayOfArrayOfNumberOnly.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayOfArrayOfNumberOnly.ts @@ -30,7 +30,7 @@ export interface ArrayOfArrayOfNumberOnly { /** * Check if a given object implements the ArrayOfArrayOfNumberOnly interface. */ -export function instanceOfArrayOfArrayOfNumberOnly(value: object): boolean { +export function instanceOfArrayOfArrayOfNumberOnly(value: object): value is ArrayOfArrayOfNumberOnly { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayOfNumberOnly.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayOfNumberOnly.ts index 4c0e2e98805b..8029e9dd15bc 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayOfNumberOnly.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayOfNumberOnly.ts @@ -30,7 +30,7 @@ export interface ArrayOfNumberOnly { /** * Check if a given object implements the ArrayOfNumberOnly interface. */ -export function instanceOfArrayOfNumberOnly(value: object): boolean { +export function instanceOfArrayOfNumberOnly(value: object): value is ArrayOfNumberOnly { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayTest.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayTest.ts index 2cdb8f33fa6f..fefc0e842b6f 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayTest.ts @@ -49,7 +49,7 @@ export interface ArrayTest { /** * Check if a given object implements the ArrayTest interface. */ -export function instanceOfArrayTest(value: object): boolean { +export function instanceOfArrayTest(value: object): value is ArrayTest { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Capitalization.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Capitalization.ts index 1d7e59d6099d..f9f38b2ed71f 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Capitalization.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Capitalization.ts @@ -61,7 +61,7 @@ export interface Capitalization { /** * Check if a given object implements the Capitalization interface. */ -export function instanceOfCapitalization(value: object): boolean { +export function instanceOfCapitalization(value: object): value is Capitalization { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Cat.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Cat.ts index 3bc2bd8cdb13..05ffd9e8fab5 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Cat.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Cat.ts @@ -37,7 +37,7 @@ export interface Cat extends Animal { /** * Check if a given object implements the Cat interface. */ -export function instanceOfCat(value: object): boolean { +export function instanceOfCat(value: object): value is Cat { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Category.ts index e571880c8e1e..640b1883c524 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Category.ts @@ -36,8 +36,8 @@ export interface Category { /** * Check if a given object implements the Category interface. */ -export function instanceOfCategory(value: object): boolean { - if (!('name' in value)) return false; +export function instanceOfCategory(value: object): value is Category { + if (!('name' in value) || value['name'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ClassModel.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ClassModel.ts index 6d9ad88c1c55..1789763aaecc 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ClassModel.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ClassModel.ts @@ -30,7 +30,7 @@ export interface ClassModel { /** * Check if a given object implements the ClassModel interface. */ -export function instanceOfClassModel(value: object): boolean { +export function instanceOfClassModel(value: object): value is ClassModel { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Client.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Client.ts index 807cd0777308..21c3a1f3b798 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Client.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Client.ts @@ -30,7 +30,7 @@ export interface Client { /** * Check if a given object implements the Client interface. */ -export function instanceOfClient(value: object): boolean { +export function instanceOfClient(value: object): value is Client { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/DeprecatedObject.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/DeprecatedObject.ts index 8eab37673066..38ae523f5b96 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/DeprecatedObject.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/DeprecatedObject.ts @@ -30,7 +30,7 @@ export interface DeprecatedObject { /** * Check if a given object implements the DeprecatedObject interface. */ -export function instanceOfDeprecatedObject(value: object): boolean { +export function instanceOfDeprecatedObject(value: object): value is DeprecatedObject { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Dog.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Dog.ts index 921e17cb803f..5df4d5123a82 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Dog.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Dog.ts @@ -37,7 +37,7 @@ export interface Dog extends Animal { /** * Check if a given object implements the Dog interface. */ -export function instanceOfDog(value: object): boolean { +export function instanceOfDog(value: object): value is Dog { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumArrays.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumArrays.ts index aa7200c92542..ddff5eeb796e 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumArrays.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumArrays.ts @@ -56,7 +56,7 @@ export type EnumArraysArrayEnumEnum = typeof EnumArraysArrayEnumEnum[keyof typeo /** * Check if a given object implements the EnumArrays interface. */ -export function instanceOfEnumArrays(value: object): boolean { +export function instanceOfEnumArrays(value: object): value is EnumArrays { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumTest.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumTest.ts index caeccfc55388..b4ef265fd2d2 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumTest.ts @@ -137,8 +137,8 @@ export type EnumTestEnumNumberEnum = typeof EnumTestEnumNumberEnum[keyof typeof /** * Check if a given object implements the EnumTest interface. */ -export function instanceOfEnumTest(value: object): boolean { - if (!('enumStringRequired' in value)) return false; +export function instanceOfEnumTest(value: object): value is EnumTest { + if (!('enumStringRequired' in value) || value['enumStringRequired'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FakeBigDecimalMap200Response.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FakeBigDecimalMap200Response.ts index 732ed05b62a0..dc65ebf50f77 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FakeBigDecimalMap200Response.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FakeBigDecimalMap200Response.ts @@ -36,7 +36,7 @@ export interface FakeBigDecimalMap200Response { /** * Check if a given object implements the FakeBigDecimalMap200Response interface. */ -export function instanceOfFakeBigDecimalMap200Response(value: object): boolean { +export function instanceOfFakeBigDecimalMap200Response(value: object): value is FakeBigDecimalMap200Response { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FileSchemaTestClass.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FileSchemaTestClass.ts index 25bf3ba4dbf1..9da5b93a1a20 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FileSchemaTestClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FileSchemaTestClass.ts @@ -36,7 +36,7 @@ export interface FileSchemaTestClass { /** * Check if a given object implements the FileSchemaTestClass interface. */ -export function instanceOfFileSchemaTestClass(value: object): boolean { +export function instanceOfFileSchemaTestClass(value: object): value is FileSchemaTestClass { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Foo.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Foo.ts index feb5e47da049..94845a52698d 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Foo.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Foo.ts @@ -30,7 +30,7 @@ export interface Foo { /** * Check if a given object implements the Foo interface. */ -export function instanceOfFoo(value: object): boolean { +export function instanceOfFoo(value: object): value is Foo { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FooGetDefaultResponse.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FooGetDefaultResponse.ts index b834ab550db6..86af8d7e7cc0 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FooGetDefaultResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FooGetDefaultResponse.ts @@ -37,7 +37,7 @@ export interface FooGetDefaultResponse { /** * Check if a given object implements the FooGetDefaultResponse interface. */ -export function instanceOfFooGetDefaultResponse(value: object): boolean { +export function instanceOfFooGetDefaultResponse(value: object): value is FooGetDefaultResponse { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FormatTest.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FormatTest.ts index f2113709741f..328ec809ee95 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FormatTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FormatTest.ts @@ -127,11 +127,11 @@ export interface FormatTest { /** * Check if a given object implements the FormatTest interface. */ -export function instanceOfFormatTest(value: object): boolean { - if (!('number' in value)) return false; - if (!('_byte' in value)) return false; - if (!('date' in value)) return false; - if (!('password' in value)) return false; +export function instanceOfFormatTest(value: object): value is FormatTest { + if (!('number' in value) || value['number'] === undefined) return false; + if (!('_byte' in value) || value['_byte'] === undefined) return false; + if (!('date' in value) || value['date'] === undefined) return false; + if (!('password' in value) || value['password'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/HasOnlyReadOnly.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/HasOnlyReadOnly.ts index 82e1d7235e13..db19db8f72cf 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/HasOnlyReadOnly.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/HasOnlyReadOnly.ts @@ -36,7 +36,7 @@ export interface HasOnlyReadOnly { /** * Check if a given object implements the HasOnlyReadOnly interface. */ -export function instanceOfHasOnlyReadOnly(value: object): boolean { +export function instanceOfHasOnlyReadOnly(value: object): value is HasOnlyReadOnly { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/HealthCheckResult.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/HealthCheckResult.ts index 83a0cf52ee15..450b2c25043b 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/HealthCheckResult.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/HealthCheckResult.ts @@ -30,7 +30,7 @@ export interface HealthCheckResult { /** * Check if a given object implements the HealthCheckResult interface. */ -export function instanceOfHealthCheckResult(value: object): boolean { +export function instanceOfHealthCheckResult(value: object): value is HealthCheckResult { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/List.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/List.ts index 5513deda0790..2b979862b769 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/List.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/List.ts @@ -30,7 +30,7 @@ export interface List { /** * Check if a given object implements the List interface. */ -export function instanceOfList(value: object): boolean { +export function instanceOfList(value: object): value is List { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MapTest.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MapTest.ts index 0ba03f9a901b..7a2a4b27fef8 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MapTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MapTest.ts @@ -59,7 +59,7 @@ export type MapTestMapOfEnumStringEnum = typeof MapTestMapOfEnumStringEnum[keyof /** * Check if a given object implements the MapTest interface. */ -export function instanceOfMapTest(value: object): boolean { +export function instanceOfMapTest(value: object): value is MapTest { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MixedPropertiesAndAdditionalPropertiesClass.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MixedPropertiesAndAdditionalPropertiesClass.ts index 156ccc8a342d..599422a3417b 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MixedPropertiesAndAdditionalPropertiesClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MixedPropertiesAndAdditionalPropertiesClass.ts @@ -49,7 +49,7 @@ export interface MixedPropertiesAndAdditionalPropertiesClass { /** * Check if a given object implements the MixedPropertiesAndAdditionalPropertiesClass interface. */ -export function instanceOfMixedPropertiesAndAdditionalPropertiesClass(value: object): boolean { +export function instanceOfMixedPropertiesAndAdditionalPropertiesClass(value: object): value is MixedPropertiesAndAdditionalPropertiesClass { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Model200Response.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Model200Response.ts index 22570495bd69..31254e14b766 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Model200Response.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Model200Response.ts @@ -36,7 +36,7 @@ export interface Model200Response { /** * Check if a given object implements the Model200Response interface. */ -export function instanceOfModel200Response(value: object): boolean { +export function instanceOfModel200Response(value: object): value is Model200Response { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ModelApiResponse.ts index 7116a59f8d22..bf92ceff548f 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ModelApiResponse.ts @@ -42,7 +42,7 @@ export interface ModelApiResponse { /** * Check if a given object implements the ModelApiResponse interface. */ -export function instanceOfModelApiResponse(value: object): boolean { +export function instanceOfModelApiResponse(value: object): value is ModelApiResponse { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ModelFile.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ModelFile.ts index dc08a2f1474a..c54577e4fc06 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ModelFile.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ModelFile.ts @@ -30,7 +30,7 @@ export interface ModelFile { /** * Check if a given object implements the ModelFile interface. */ -export function instanceOfModelFile(value: object): boolean { +export function instanceOfModelFile(value: object): value is ModelFile { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Name.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Name.ts index 9b861d6d4d14..dbcf899e8541 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Name.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Name.ts @@ -48,8 +48,8 @@ export interface Name { /** * Check if a given object implements the Name interface. */ -export function instanceOfName(value: object): boolean { - if (!('name' in value)) return false; +export function instanceOfName(value: object): value is Name { + if (!('name' in value) || value['name'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NullableClass.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NullableClass.ts index b64cd7d8f452..2fbcea7c6eac 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NullableClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NullableClass.ts @@ -97,7 +97,7 @@ export interface NullableClass { /** * Check if a given object implements the NullableClass interface. */ -export function instanceOfNullableClass(value: object): boolean { +export function instanceOfNullableClass(value: object): value is NullableClass { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NumberOnly.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NumberOnly.ts index 155afb118e43..c778f996c1a2 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NumberOnly.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NumberOnly.ts @@ -30,7 +30,7 @@ export interface NumberOnly { /** * Check if a given object implements the NumberOnly interface. */ -export function instanceOfNumberOnly(value: object): boolean { +export function instanceOfNumberOnly(value: object): value is NumberOnly { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ObjectWithDeprecatedFields.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ObjectWithDeprecatedFields.ts index d24ea8fc197e..99c4b488c489 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ObjectWithDeprecatedFields.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ObjectWithDeprecatedFields.ts @@ -58,7 +58,7 @@ export interface ObjectWithDeprecatedFields { /** * Check if a given object implements the ObjectWithDeprecatedFields interface. */ -export function instanceOfObjectWithDeprecatedFields(value: object): boolean { +export function instanceOfObjectWithDeprecatedFields(value: object): value is ObjectWithDeprecatedFields { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Order.ts index 8921894971d6..7b83e804baad 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Order.ts @@ -72,7 +72,7 @@ export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnu /** * Check if a given object implements the Order interface. */ -export function instanceOfOrder(value: object): boolean { +export function instanceOfOrder(value: object): value is Order { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterComposite.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterComposite.ts index 49d8ad5cc5b1..c965a360d04b 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterComposite.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterComposite.ts @@ -42,7 +42,7 @@ export interface OuterComposite { /** * Check if a given object implements the OuterComposite interface. */ -export function instanceOfOuterComposite(value: object): boolean { +export function instanceOfOuterComposite(value: object): value is OuterComposite { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterObjectWithEnumProperty.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterObjectWithEnumProperty.ts index 3990064c3484..c8ca1734039f 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterObjectWithEnumProperty.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterObjectWithEnumProperty.ts @@ -37,8 +37,8 @@ export interface OuterObjectWithEnumProperty { /** * Check if a given object implements the OuterObjectWithEnumProperty interface. */ -export function instanceOfOuterObjectWithEnumProperty(value: object): boolean { - if (!('value' in value)) return false; +export function instanceOfOuterObjectWithEnumProperty(value: object): value is OuterObjectWithEnumProperty { + if (!('value' in value) || value['value'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Pet.ts index 1f29621cb3b4..f2ad3c1ee466 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Pet.ts @@ -85,9 +85,9 @@ export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum]; /** * Check if a given object implements the Pet interface. */ -export function instanceOfPet(value: object): boolean { - if (!('name' in value)) return false; - if (!('photoUrls' in value)) return false; +export function instanceOfPet(value: object): value is Pet { + if (!('name' in value) || value['name'] === undefined) return false; + if (!('photoUrls' in value) || value['photoUrls'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ReadOnlyFirst.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ReadOnlyFirst.ts index f1f5a01a89b6..9bd46c432fca 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ReadOnlyFirst.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ReadOnlyFirst.ts @@ -36,7 +36,7 @@ export interface ReadOnlyFirst { /** * Check if a given object implements the ReadOnlyFirst interface. */ -export function instanceOfReadOnlyFirst(value: object): boolean { +export function instanceOfReadOnlyFirst(value: object): value is ReadOnlyFirst { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Return.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Return.ts index 68b15542cbbd..3de8fb2d62be 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Return.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Return.ts @@ -30,7 +30,7 @@ export interface Return { /** * Check if a given object implements the Return interface. */ -export function instanceOfReturn(value: object): boolean { +export function instanceOfReturn(value: object): value is Return { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/SpecialModelName.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/SpecialModelName.ts index b302e6f03627..34edcaa2f004 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/SpecialModelName.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/SpecialModelName.ts @@ -30,7 +30,7 @@ export interface SpecialModelName { /** * Check if a given object implements the SpecialModelName interface. */ -export function instanceOfSpecialModelName(value: object): boolean { +export function instanceOfSpecialModelName(value: object): value is SpecialModelName { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Tag.ts index 4ae4af399fd8..f0ecd59d5ba2 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Tag.ts @@ -36,7 +36,7 @@ export interface Tag { /** * Check if a given object implements the Tag interface. */ -export function instanceOfTag(value: object): boolean { +export function instanceOfTag(value: object): value is Tag { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/User.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/User.ts index c85ea3d6ed63..2028044d626c 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/User.ts @@ -72,7 +72,7 @@ export interface User { /** * Check if a given object implements the User interface. */ -export function instanceOfUser(value: object): boolean { +export function instanceOfUser(value: object): value is User { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Category.ts index 19e40eaf4b86..54f256e339f5 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Category.ts @@ -36,7 +36,7 @@ export interface Category { /** * Check if a given object implements the Category interface. */ -export function instanceOfCategory(value: object): boolean { +export function instanceOfCategory(value: object): value is Category { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/ModelApiResponse.ts index 4496efe73f05..bc250bd002cb 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/ModelApiResponse.ts @@ -42,7 +42,7 @@ export interface ModelApiResponse { /** * Check if a given object implements the ModelApiResponse interface. */ -export function instanceOfModelApiResponse(value: object): boolean { +export function instanceOfModelApiResponse(value: object): value is ModelApiResponse { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Order.ts index 948cda435c8a..f1a3a4bb0f0a 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Order.ts @@ -72,7 +72,7 @@ export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnu /** * Check if a given object implements the Order interface. */ -export function instanceOfOrder(value: object): boolean { +export function instanceOfOrder(value: object): value is Order { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Pet.ts index 3c60d980598b..476b11aa0efc 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Pet.ts @@ -85,9 +85,9 @@ export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum]; /** * Check if a given object implements the Pet interface. */ -export function instanceOfPet(value: object): boolean { - if (!('name' in value)) return false; - if (!('photoUrls' in value)) return false; +export function instanceOfPet(value: object): value is Pet { + if (!('name' in value) || value['name'] === undefined) return false; + if (!('photoUrls' in value) || value['photoUrls'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Tag.ts index 0a5bdbdde07c..fd877416ade1 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Tag.ts @@ -36,7 +36,7 @@ export interface Tag { /** * Check if a given object implements the Tag interface. */ -export function instanceOfTag(value: object): boolean { +export function instanceOfTag(value: object): value is Tag { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/User.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/User.ts index 3924497622f9..149be73b9ffc 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/User.ts @@ -72,7 +72,7 @@ export interface User { /** * Check if a given object implements the User interface. */ -export function instanceOfUser(value: object): boolean { +export function instanceOfUser(value: object): value is User { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Category.ts index 19e40eaf4b86..54f256e339f5 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Category.ts @@ -36,7 +36,7 @@ export interface Category { /** * Check if a given object implements the Category interface. */ -export function instanceOfCategory(value: object): boolean { +export function instanceOfCategory(value: object): value is Category { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/ModelApiResponse.ts index 4496efe73f05..bc250bd002cb 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/ModelApiResponse.ts @@ -42,7 +42,7 @@ export interface ModelApiResponse { /** * Check if a given object implements the ModelApiResponse interface. */ -export function instanceOfModelApiResponse(value: object): boolean { +export function instanceOfModelApiResponse(value: object): value is ModelApiResponse { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Order.ts index 948cda435c8a..f1a3a4bb0f0a 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Order.ts @@ -72,7 +72,7 @@ export type OrderStatusEnum = typeof OrderStatusEnum[keyof typeof OrderStatusEnu /** * Check if a given object implements the Order interface. */ -export function instanceOfOrder(value: object): boolean { +export function instanceOfOrder(value: object): value is Order { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Pet.ts index 3c60d980598b..476b11aa0efc 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Pet.ts @@ -85,9 +85,9 @@ export type PetStatusEnum = typeof PetStatusEnum[keyof typeof PetStatusEnum]; /** * Check if a given object implements the Pet interface. */ -export function instanceOfPet(value: object): boolean { - if (!('name' in value)) return false; - if (!('photoUrls' in value)) return false; +export function instanceOfPet(value: object): value is Pet { + if (!('name' in value) || value['name'] === undefined) return false; + if (!('photoUrls' in value) || value['photoUrls'] === undefined) return false; return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Tag.ts index 0a5bdbdde07c..fd877416ade1 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Tag.ts @@ -36,7 +36,7 @@ export interface Tag { /** * Check if a given object implements the Tag interface. */ -export function instanceOfTag(value: object): boolean { +export function instanceOfTag(value: object): value is Tag { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/User.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/User.ts index 3924497622f9..149be73b9ffc 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/User.ts @@ -72,7 +72,7 @@ export interface User { /** * Check if a given object implements the User interface. */ -export function instanceOfUser(value: object): boolean { +export function instanceOfUser(value: object): value is User { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/EnumPatternObject.ts b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/EnumPatternObject.ts index a902fb9c9af3..8f61f66faaa1 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/EnumPatternObject.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/EnumPatternObject.ts @@ -61,7 +61,7 @@ export interface EnumPatternObject { /** * Check if a given object implements the EnumPatternObject interface. */ -export function instanceOfEnumPatternObject(value: object): boolean { +export function instanceOfEnumPatternObject(value: object): value is EnumPatternObject { return true; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/FakeEnumRequestGetInline200Response.ts b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/FakeEnumRequestGetInline200Response.ts index a801fcf5ef18..fe388268b172 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/FakeEnumRequestGetInline200Response.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/FakeEnumRequestGetInline200Response.ts @@ -86,7 +86,7 @@ export enum FakeEnumRequestGetInline200ResponseNullableNumberEnumEnum { /** * Check if a given object implements the FakeEnumRequestGetInline200Response interface. */ -export function instanceOfFakeEnumRequestGetInline200Response(value: object): boolean { +export function instanceOfFakeEnumRequestGetInline200Response(value: object): value is FakeEnumRequestGetInline200Response { return true; }