Summary: Tuples: Define a fixed-length array where each element can have a different type. Usage: Useful for representing structured data where the order and types of elements are important (e.g., returning multiple values from a function).
type User = [number,string] let usr1:User = [101,"chiranjeeb"] usr1.push(true) console.log(usr1) this is not allowing me to do push operations Error :- first.ts:12:11 - error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'.
Hi Sir, one query as we know array is group same datatypes, but now by declaring datatypes we are able to pass different datatype elements to same array.. please tell how it is?
Learn full stack developer with live classes:
hc.lco.dev/jscamp2
I know all this stuff, still i watch the full video, because it is fun to watch your video and the way you teach. 😊
You are the "Virat Kohli" of Coding Community.
Summary:
Tuples: Define a fixed-length array where each element can have a different type.
Usage: Useful for representing structured data where the order and types of elements are important (e.g., returning multiple values from a function).
SUPER topic HITESH SIR...😀😀😀
Now the push is showing me error that => type 'boolean' is not assignable to parameter of type 'string | number' maybe that issue has been solved!
Yeah seems that they have fixed this issue now I am getting an error while using push and unshift
type User = [number,string]
let usr1:User = [101,"chiranjeeb"]
usr1.push(true)
console.log(usr1)
this is not allowing me to do push operations
Error :- first.ts:12:11 - error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'.
true is of type boolean which is neither a number nor a string. Please read the error carefully.
Yes, if you pass the number or string than only you will able to do array methods.
Yes , even I watched video and there it's working fine even when I implemented it was showing same error.
that's actually good its preventing us from pushing beyond its limits.
Always Great to Learn From You Sir😊
Awesome ❤❤❤❤
Love you sir you are just amazing
I guess U have become bhrmastr of coders sir. Every warrior(coder) wanted n loves u bt wanted to keep u secret for future combat reasons.
Please share SO question link
Hi Sir, one query as we know array is group same datatypes, but now by declaring datatypes we are able to pass different datatype elements to same array.. please tell how it is?
I think you should learn javascript first
nice explanation !
We can fix that issues with tuples using readonly keyword but how tf I am gonna remember it everytime while creating applications 😭😭
Thank you sir....
rgb stands for? in 6th line
colors red-green-blue
now the push is showing the error
this is not what a "tuple" is, But ok nice clickbait
awesome
Nice 🥰🥰
Thank you :)
Hello sir can you please make this series in Hindi Language.
cool
♥️♥️♥️
day 2