brianloveswords / base64url

For encoding and decoding base64url!
MIT License
224 stars 44 forks source link

Missing definition for the types file #29

Closed sgronblo closed 5 years ago

sgronblo commented 6 years ago

Using base64url@3.0.0 with typescript@2.8.3 and Node 8.11.1

Code:

import base64url from 'base64url'

Results in the error:

Could not find a declaration file for module 'base64url'. '/Users/samu/projects/reaktor/vaana/vaana-login/node_modules/base64url/index.js' implicitly has an 'any' type. Try npm install @types/base64url if it exists or add a new declaration (.d.ts) file containing declare module 'base64url';

Based on the instructions here: https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html#iincluding-declarations-in-your-npm-package

You need to either define the index.d.ts file explicitly using types in package.json or if your package is based on index.js as the entry point then a default of index.d.ts is used.

Adding "types": "./dist/base64url.d.ts" to the package.json file for base64url gets rid of the error message.