Git Product home page Git Product logo

deviantart.ts's People

Contributors

dependabot[bot] avatar tenpi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

cleancoindev

deviantart.ts's Issues

Type declarations and real object at runtime is different

So I tried running a simplified version of the example code below:

import DeviantArt from "deviantart.ts"
 
async function main() {
    const da = await DeviantArt.login(process.env.DA_CLIENTID, process.env.DA_SECRET)
}

main()

but it gives an error instead:

(node:11368) UnhandledPromiseRejectionWarning: TypeError: DeviantArt.login is not a function

So I tried to see what the real representation of DeviantArt looks like, which is:

{
    __esModule: true,
    default: [Function: DeviantArt] { login: [Function (anonymous)] },
    Deviation: [Function: Deviation],
    Gallery: [Function: Gallery],
    RSS: [Function: RSS],
    User: [Function: User],
    Util: [Function: Util],
    Browse: [Function: Browse],
    Curated: [Function: Curated],
    Stash: [Function: Stash],
    Collections: [Function: Collections],
    Comments: [Function: Comments],
    Data: [Function: Data]
}

and then changed my code to:

import DeviantArt from "deviantart.ts"
 
async function main() {
    const da = await DeviantArt.default.login(process.env.DA_CLIENTID, process.env.DA_SECRET)
}

main()

but then tsc will complain during transpilation like so:

index.ts:26:28 - error TS2339: Property 'default' does not exist on type 'typeof DeviantArt'.

The only workaround I know is to modify the transpiled function directly by hand, from DeviantArt.login into DeviantArt.default.login. Or am I doing something wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.