Giter Site home page Giter Site logo

Comments (6)

Caligatio avatar Caligatio commented on May 31, 2024 2

I can do a PR but I admittedly I'm not DefinitelyTyped expert. Should it be:

getHMAC(key:string, inputFormat:string, variant:string, outputFormat:string, outputFormatOpts?:OutputFormatOptions):string;

If so, I'll submit things

from jssha.

ppiatek avatar ppiatek commented on May 31, 2024 1

Check these 2 files:
\node_modules\@types\jssha\index.d.ts
\node_modules\@types\jssha\jssha-1.6.0.d.ts

I copied content of jssha-1.6.0.d.ts and inserted to index.d.ts
These helped me. I know that I shouldn't touch files in node_modules folder but I don't know how to do this in other way.

It seems that definition is wrong of function getHMAC in index.d.ts but it is correct in second file.
Maybe someone find more beautiful solution but this works for me.

from jssha.

Caligatio avatar Caligatio commented on May 31, 2024

Is that signature error some sort of Typescript error? I've never seen JavaScript emit something like that. My guess is that Typescript doesn't like optional parameters so try passing in an empty map, {}, as an extra last parameter.

from jssha.

Caligatio avatar Caligatio commented on May 31, 2024

Is this something I can actually fix or is there something wrong with whatever helper libraries you are using?

from jssha.

davidLeonardi avatar davidLeonardi commented on May 31, 2024

This is an issue with the community contributed type definitions for typescript, and something that should be fixed in the "definitelyTyped" repository.
Specifically, this file:
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/jssha/index.d.ts
or this file:
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/jssha/jssha-1.6.0.d.ts

from jssha.

Caligatio avatar Caligatio commented on May 31, 2024

I think I understand what's going on. Whatever tutorial you're using is using an old version of jsSHA (the v1 branch) which is deprecated and only receiving bug fixes. The DefinitelyTyped library moved on to the v2 API, thus the mismatch between the index.d.ts and jssha-1.6.0.d.ts. It also appears that someone deleted the jssha-1.6.0.d.ts file from DefinitelyTyped so I don't know if they're no longer supporting the concept of "old" library versions.

I'm closing this because it essentially has nothing to do with jsSHA and everything to do with DefinitelyTyped.

from jssha.

Related Issues (20)

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.