typed-typings / npm-ramda

TypeScript's type definitions for Ramda
MIT License
384 stars 64 forks source link

R.Path - Typescript error for an array of objects #430

Open e1um opened 5 years ago

e1um commented 5 years ago
const emailData = {
    payload: {
        headers: [{ name: "header1", value: "value1" }, { name: "header2", value: "value2" }]
    }
}

const headers = R.path(['payload', 'headers'], emailData)
//[{ name: "header1", value: "value1" }, { name: "header2", value: "value2" }]
screen shot 2019-02-20 at 3 16 27 pm

This returns a type of 'path_11<{}>' when it should be typed with a 'path_11<List<{}>>'. When I try and call R.find() on 'headers' I get an error

screen shot 2019-02-20 at 3 20 12 pm

**Apologies if I'm not using the right lingo... fairly new to typescript.