Tuples in typescript

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ต.ค. 2024

ความคิดเห็น • 34

  • @HiteshCodeLab
    @HiteshCodeLab  2 ปีที่แล้ว +4

    Learn full stack developer with live classes:
    hc.lco.dev/jscamp2

    • @akashpwl
      @akashpwl 2 ปีที่แล้ว

      I know all this stuff, still i watch the full video, because it is fun to watch your video and the way you teach. 😊

  • @MohammedAzharuddin-x2y
    @MohammedAzharuddin-x2y หลายเดือนก่อน +1

    A Tuple can be made immutable by applying the `readonly` modifier, preventing any changes to its values.
    Example:
    type Person = readonly [string, number, string];
    let person: Person = ['John Smith', 45, 'Male'];
    person.push('some value'); // Error: Property 'push' does not exist on type 'Person'.

  • @muthuvalli333
    @muthuvalli333 2 ปีที่แล้ว +1

    SUPER topic HITESH SIR...😀😀😀

  • @nobody20022
    @nobody20022 หลายเดือนก่อน

    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).

  • @movingmelody3181
    @movingmelody3181 2 ปีที่แล้ว +2

    You are the "Virat Kohli" of Coding Community.

  • @aniksaha8108
    @aniksaha8108 4 หลายเดือนก่อน +3

    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!

    • @UtkarshSharma-di7vo
      @UtkarshSharma-di7vo 24 วันที่ผ่านมา

      Yeah seems that they have fixed this issue now I am getting an error while using push and unshift

  • @Kumar-bb9jb
    @Kumar-bb9jb 2 ปีที่แล้ว

    Always Great to Learn From You Sir😊

  • @LaveshGarg
    @LaveshGarg 2 ปีที่แล้ว

    Love you sir you are just amazing

  • @chandanchiranjeebsahoo1507
    @chandanchiranjeebsahoo1507 2 ปีที่แล้ว +1

    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'.

    • @mega123a
      @mega123a ปีที่แล้ว +1

      true is of type boolean which is neither a number nor a string. Please read the error carefully.

    • @diffcoder
      @diffcoder ปีที่แล้ว +1

      Yes, if you pass the number or string than only you will able to do array methods.

    • @vikasmv5952
      @vikasmv5952 ปีที่แล้ว

      Yes , even I watched video and there it's working fine even when I implemented it was showing same error.

    • @Alpha-nn8mn
      @Alpha-nn8mn 10 หลายเดือนก่อน

      that's actually good its preventing us from pushing beyond its limits.

  • @Vikas-dm9uc
    @Vikas-dm9uc 2 ปีที่แล้ว

    Awesome ❤❤❤❤

  • @greenshaheen6716
    @greenshaheen6716 2 ปีที่แล้ว

    nice explanation !

  • @amitgoyal8760
    @amitgoyal8760 ปีที่แล้ว

    We can fix that issues with tuples using readonly keyword but how tf I am gonna remember it everytime while creating applications 😭😭

  • @ankushladani496
    @ankushladani496 2 ปีที่แล้ว

    Thank you sir....

  • @Vikas-dm9uc
    @Vikas-dm9uc 2 ปีที่แล้ว

    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.

  • @arunjoshi7885
    @arunjoshi7885 2 ปีที่แล้ว

    awesome

  • @umadeviyelakurthy5873
    @umadeviyelakurthy5873 2 ปีที่แล้ว

    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?

    • @RahulGuptaa29
      @RahulGuptaa29 4 หลายเดือนก่อน

      I think you should learn javascript first

  • @Priyanka-bd6um
    @Priyanka-bd6um ปีที่แล้ว

    Thank you :)

  • @almairtaza3793
    @almairtaza3793 4 หลายเดือนก่อน

    rgb stands for? in 6th line

  • @narutokunn
    @narutokunn 2 ปีที่แล้ว

    Please share SO question link

  • @SurinderKumar-m9d
    @SurinderKumar-m9d 2 หลายเดือนก่อน

    Hello sir can you please make this series in Hindi Language.

  • @asadanik5987
    @asadanik5987 2 ปีที่แล้ว

    Nice 🥰🥰

  • @ankit21309
    @ankit21309 4 หลายเดือนก่อน

    now the push is showing the error

  • @ckpioo
    @ckpioo 5 หลายเดือนก่อน +1

    this is not what a "tuple" is, But ok nice clickbait

  • @bishalnandi9633
    @bishalnandi9633 2 ปีที่แล้ว

    ♥️♥️♥️

  • @Dev-Phantom
    @Dev-Phantom 2 หลายเดือนก่อน

    cool

  • @anuraggupta1008
    @anuraggupta1008 4 หลายเดือนก่อน

    day 2