'Cypress typescript error src/index.d.ts' is not a module.ts(2306)how to fix

I want to create a custom command. I couldn't work out how to get my custom command just to return a value without having to use this disgusting .then syntax which doesn't have a good developer experience (Basically retrieving a bunch of creds)

I just want a simple function:

getCred(username_key)

and that returns a username instead of:

cy.getCreds(username_key).then(cred=> {
etc
})

So I have the following function:

export const credentialsAre =  (key) => {
    const parsedata = JSON.parse(testdata)
    console.log("key is: ", key);
    return parsedata.Credentials[key]
}

but importing it in another repo I get this error:

import {credentialsAre} from '@mycustomcommands'
File '/src/index.d.ts' is not a module.ts(2306)

How do I fix that?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source