<commit_before>import {jsonArrayMember, jsonMember, jsonObject, TypedJSON} from '../src/typedjson';
import {IndexedObject} from '../src/typedjson/types';

describe('polymorphism custom type hints', () => {
    describe('should work for a base class', () => {
        @jsonObject({
            typeHintEmitter: (targetObject, sourceObject) => {
                return targetObject.personType = `${sourceObject.constructor.name}Type`;
            },
            typeResolver: sourceObject => TYPE_MAP[sourceObject.personType],
        })
        abstract class Person {
            @jsonMember
            firstName: string;

            @jsonMember
            lastName: string;

            constructor(firstName?: string, lastName?: string);
            constructor(firstName: string, lastName: string);
            constructor(firstName?: string, lastName?: string) {
                if (firstName !== undefined && lastName !== undefined) {
                    this.firstName = firstName;
                    this.lastName = lastName;
                }
            }
        }
<commit_msg>Do not return in typeHintEmitter<commit_after>import {jsonArrayMember, jsonMember, jsonObject, TypedJSON} from '../src/typedjson';
import {IndexedObject} from '../src/typedjson/types';

describe('polymorphism custom type hints', () => {
    describe('should work for a base class', () => {
        @jsonObject({
            typeHintEmitter: (targetObject, sourceObject) => {
                targetObject.personType = `${sourceObject.constructor.name}Type`;
            },
            typeResolver: sourceObject => TYPE_MAP[sourceObject.personType],
        })
        abstract class Person {
            @jsonMember
            firstName: string;

            @jsonMember
            lastName: string;

            constructor(firstName?: string, lastName?: string);
            constructor(firstName: string, lastName: string);
            constructor(firstName?: string, lastName?: string) {
                if (firstName !== undefined && lastName !== undefined) {
                    this.firstName = firstName;
                    this.lastName = lastName;
                }
            }
        }

{'fraction_non_alphanumeric': 0.11212397447584321, 'fraction_numerical': 0.0, 'mean_word_length': 2.048611111111111, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3859876', 'n_tokens_mistral': 546, 'n_tokens_neox': 530, 'n_words': 125}