Initializing JSON object in TypeScript

前端 未结 3 800
情深已故
情深已故 2021-02-02 12:28

I\'m new to TypeScript and I\'m stuck at working with JSON. I need to create a simple JSON object and I keep on failing doing so. Here are my first attempts:

out         


        
3条回答
  •  心在旅途
    2021-02-02 13:15

    You can also do the following

    const rememberUser:JSON = {
            "username": this.credentialsForm.value.username,
            "password": this.credentialsForm.value.password
          }
    

提交回复
热议问题