asmcrypto / asmcrypto.js

JavaScript Cryptographic Library with performance in mind.
MIT License
659 stars 182 forks source link

Type declaration files for asm.js files are not included in distribution #156

Closed bitjson closed 6 years ago

bitjson commented 6 years ago

If the consumer has noImplicitAny enabled, installing this library will cause the following TypeScript compilation error:

node_modules/asmcrypto.js/dist_es8/aes/aes.d.ts:1:35 - error TS7016: Could not find a declaration file for module './aes.asm'. 'bitcoin-ts/node_modules/asmcrypto.js/dist_es8/aes/aes.asm.js' implicitly has an 'any' type.
  Try `npm install @types/asmcrypto.js` if it exists or add a new declaration (.d.ts) file containing `declare module 'asmcrypto.js';`

import { AES_asm, AES_mode } from './aes.asm';
                                    ~~~~~~~~~~~

node_modules/asmcrypto.js/dist_es8/bignum/bignum.d.ts:1:30 - error TS7016: Could not find a declaration file for module './bigint.asm'. 'bitcoin-ts/node_modules/asmcrypto.js/dist_es8/bignum/bigint.asm.js' implicitly has an 'any' type.
  Try `npm install @types/asmcrypto.js` if it exists or add a new declaration (.d.ts) file containing `declare module 'asmcrypto.js';`

import { bigintresult } from './bigint.asm';
                               ~~~~~~~~~~~~~~

node_modules/asmcrypto.js/dist_es8/hash/hash.d.ts:1:28 - error TS7016: Could not find a declaration file for module './sha1/sha1.asm'. 'bitcoin-ts/node_modules/asmcrypto.js/dist_es8/hash/sha1/sha1.asm.js' implicitly has an 'any' type.
  Try `npm install @types/asmcrypto.js` if it exists or add a new declaration (.d.ts) file containing `declare module 'asmcrypto.js';`

import { sha1result } from './sha1/sha1.asm';
                             ~~~~~~~~~~~~~~~~~

node_modules/asmcrypto.js/dist_es8/hash/hash.d.ts:2:30 - error TS7016: Could not find a declaration file for module './sha256/sha256.asm'. 'bitcoin-ts/node_modules/asmcrypto.js/dist_es8/hash/sha256/sha256.asm.js' implicitly has an 'any' type.
  Try `npm install @types/asmcrypto.js` if it exists or add a new declaration (.d.ts) file containing `declare module 'asmcrypto.js';`

import { sha256result } from './sha256/sha256.asm';
                               ~~~~~~~~~~~~~~~~~~~~~

node_modules/asmcrypto.js/dist_es8/hash/hash.d.ts:3:30 - error TS7016: Could not find a declaration file for module './sha512/sha512.asm'. 'bitcoin-ts/node_modules/asmcrypto.js/dist_es8/hash/sha512/sha512.asm.js' implicitly has an 'any' type.
  Try `npm install @types/asmcrypto.js` if it exists or add a new declaration (.d.ts) file containing `declare module 'asmcrypto.js';`

import { sha512result } from './sha512/sha512.asm';
                               ~~~~~~~~~~~~~~~~~~~~~

To resolve, this library needs to also copy the following files into the distributed files:

src/aes/aes.asm.d.ts
src/bignum/bigint.asm.d.ts
src/hash/sha1/sha1.asm.d.ts
src/hash/sha256/sha256.asm.d.ts
src/hash/sha512/sha512.asm.d.ts
alippai commented 6 years ago

How about this solution? https://github.com/asmcrypto/asmcrypto.js/pull/158

bitjson commented 6 years ago

🤦‍♂️ somehow missed that file. That's a much better solution 👍

alippai commented 6 years ago

@bitjson v2.3.2 is released with this change.

alippai commented 6 years ago

Thanks for the contribution and report!