Skip to content

getAuthUrl does not return a promise, and causes Typescript compilation errors #27

@jlengrand

Description

@jlengrand

See https://github.com/esteban-uo/picasa/blob/master/src/picasa.js#L129

getAuthUrl directly returns a String, but the doc mentions a Promise.

Using the code as follows :

app.get('/login', (req, res) => {
    const authURL = picasa.getAuthURL(googleConfig);
    res.redirect(authURL);
});

raises the following Typescript compilation error:

scripts/loginAndGetGoogleToken.ts:21:18 - error TS2345: Argument of type 'Promise<any>' is not assignable to parameter of type 'string'.

21     res.redirect(authURL);
                    ~~~~~~~

Because microsoft/TypeScript#19139 is still open, there is no way to fix this without changing the documentation.

The doc for this method should be changed, and mention that it returns a String instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions