How to reduce javascript object to only contain properties from interface

后端 未结 7 1381
迷失自我
迷失自我 2020-12-06 04:29

When using typescript a declared interface could look like this:

interface MyInterface {
  test: string;
}

And an implementation with extra

7条回答
  •  伪装坚强ぢ
    2020-12-06 04:52

    In your example newTest property won't be accessible thru the reduced variable, so that's the goal of using types. The typescript brings type checking, but it doesn't manipulates the object properties.

提交回复
热议问题