Giter Site home page Giter Site logo

Typescript types about mcl-wasm HOT 5 CLOSED

herumi avatar herumi commented on July 28, 2024
Typescript types

from mcl-wasm.

Comments (5)

herumi avatar herumi commented on July 28, 2024 1

Okay, I'll make it. Please wait a moment.

from mcl-wasm.

herumi avatar herumi commented on July 28, 2024 1

I've solved it by adding a never member to distinguish Fp and Fr.

from mcl-wasm.

herumi avatar herumi commented on July 28, 2024

I'm developing https://github.com/herumi/mcl-wasm/blob/typescript/src/index.d.ts and it seems to run mostly well.
But it has something wrong.
If I comment out mapToG1,

% npx tsc test/test-ts.ts
test/test-ts.ts:247:13 - error TS2345: Argument of type 'Fr' is not assignable to parameter of type 'Fp'.
  Property 'mapToG1' is missing in type 'IntType' but required in type 'Fp'.

247     z.set_a(c)
                ~

  src/index.d.ts:49:5
    49     mapToG1(): G1; // QQQ : why does this cause an error?
           ~~~~~~~
    'mapToG1' is declared here.

test/test-ts.ts:447:25 - error TS2345: Argument of type 'Fr' is not assignable to parameter of type 'G1'.
  Type 'IntType' is missing the following properties from type 'G1': setX, setY, setZ, getX, and 5 more.

447   const e = mcl.pairing(mcl.mul(mpk, r), Q)

I I wonder why mcl.add for Fp returns mcl.Fr.
I'm just starting to study TypeScript and I'm not sure.

from mcl-wasm.

herumi avatar herumi commented on July 28, 2024

6c4d1c0

from mcl-wasm.

jacque006 avatar jacque006 commented on July 28, 2024

Thanks @herumi !

from mcl-wasm.

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.