Skip to content

Property 'find' does not exist on type 'Token[]'. #928

@SeanningTatum

Description

@SeanningTatum

Typescript recognize es6 array functions

function findDate(tokenArray: Array<Token>) {

  // Find Month in sentence
  const token: Token = tokenArray.find((token) => {
    const month = token.text.content.toUpperCase()

    return MONTHS.includes(month)
  })

  console.log(token)

  return ''
}

I've tried creating a tsconfig.json but still doesn't work

{
  "compilerOptions": {
    "module": "es6",
    "lib": [ "es2017", "dom" ]
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions