TypeScript Object Type

TypeScript Object Type

Object type represents the non-primitive type and almost same as the new object type. object(lowercase) represent non-primitive type, While Object(uppercase) represents the common to all JavaScript objects, that included some methods like toString(), valueOf(), hasOwnProperty etc.

 

lib.es6.d.ts file shipping with TypeScript that contain the Object type details as follows:

  

        interface Object {
        // ...

        /** Returns a string representation of an object. */
        toString(): string;

        /** Returns a date converted to a string using the current locale. */
        toLocaleString(): string;

        /** Returns the primitive value of the specified object. */
        valueOf(): Object;

        /**
        * Determines whether an object has a property with the specified name.
        * @param v A property name.
        */
        hasOwnProperty(v: string): boolean;

        /**
        * Determines whether an object exists in another object's prototype chain.
        * @param v Another object whose prototype chain is to be checked.
        */
        isPrototypeOf(v: Object): boolean;

        /**
        * Determines whether a specified property is enumerable.
        * @param v A property name.
        */
        propertyIsEnumerable(v: string): boolean;
        }