InsideDarkWeb.com

Is there any way to check if a typescript class has a property?

Let’s say i have a class like this:

export class Test{
  public prop: string;
}

and at the start, I call

const obj = new Test(); 

is there any way that I can see what properties I have on the Test model without assigning the properties,
I tried this but it does not work

console.log(obj.hasOwnProperty('prop')) 

Stack Overflow Asked by Branko Simovic on November 22, 2021

0 Answers

Add your own answers!

Related Questions

Extract value of column from a line (variable)

4  Asked on December 4, 2020 by user4516211

       

Merge Two Files in Weka based on date

1  Asked on December 4, 2020 by spwath

 

Set Session ID Cookie in Nuxt Auth

1  Asked on December 4, 2020 by dominooch

   

Warnings in gcc compiler

1  Asked on December 3, 2020 by hygor-marques

     

C recursion return values

1  Asked on December 3, 2020 by johnsulaw

       

React and reCAPTCHA v3

3  Asked on December 3, 2020 by comcool

   

Sympy string to equation

1  Asked on December 3, 2020 by mel

   

type casting boost multiprecision integer returns wrong answer

2  Asked on December 3, 2020 by amritkrs

   

Ask a Question

Get help from others!

© 2021 InsideDarkWeb.com. All rights reserved.