Created
January 12, 2022 19:55
-
-
Save rahulbanerjee26/c3ea411e9cf6aa0ead55b6943f4580ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Declaring object with no types | |
let user = { | |
id: 10, | |
name: 'Rahul', | |
email: 'a@g.com' | |
} | |
console.log(user.name) | |
// Rahul | |
console.log(user.email) | |
// a@g.com | |
console.log(user.number) | |
// error TS2339: Property 'number' does not exist on type '{ id: number; name: string; email: string; }' | |
user.age = 20 | |
// error TS2339: Property 'age' does not exist on type '{ id: number; name: string; email: string; }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment