Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

312
Views
why typescript string & number show never?

I was studing Typescript, but I have some confusion.

type t = number & string // never
type t1 = number & boolean // never
type t2 = number & string[] // number & string[]

Why does it look different?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

In Typescipt the instersection & of two primitive types is always never because a variabe cannot be both string and a number, but the intersection of two array/object is called as branded object and one array/object with a primitive is a valid type and is called as branded primitve , so where do we use branded primitive ? , refer the below example

type SomeUrl = string & {'this is a url': {}};

let x = <SomeUrl>'';
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!