Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

types for parameter destructuring

// How to you apply types to destructured parameters?
function args({ a, b }){
  ...
}

// TypeScript: types for parameter destructuring
function args({ a, b }:{ a: string, b: boolean }){
  ...
}

args({ a: "a", b: false });
 
PREVIOUS NEXT
Tagged: #types #parameter #destructuring
ADD COMMENT
Topic
Name
8+4 =