RecipesChapter 9: The Standard Library and External Type Definitions

Expanding Types for Array.prototype.includes

Recipe 9.4 from The TypeScript Cookbook

function execute(action: number) {
  if(includes(actions, action)) {
//            ^
// Argument of type 'readonly ["CREATE", "READ", "UPDATE", "DELETE"]' 
// is not assignable to parameter of type 'readonly number[]'.
  }
}
Open in TypeScript Playground →