Furry / 2captcha

A wrapper around the 2captcha api
71 stars 23 forks source link

Update readme.md #5

Closed ptommasi closed 3 years ago

ptommasi commented 3 years ago

In the base64 example, "solver" is "Solver" (there is a misspell on the first s, it should be capital)

Furry commented 3 years ago

Thanks for spotting it!

ptommasi commented 3 years ago

Btw, it might be also worth mentioning that - since your project is in TypeScript - using this style of import:

import { Solver } from "2captcha";
const solver = new Solver(<...>);

Instead of:

const Captcha = require("2captcha")
const solver = new Captcha.Solver(<...>);

Will enable typings on your objects! Might be worth to put it somewhere in your doc that you support TypeScript, it's just free brownie points! (Unless I got something wrong, or actually that import doesn't work, because I didn't have a chance to try it).

Furry commented 3 years ago

To my understanding, if 'types' is specified in the package.json, The IDE will by default use the typescript for all associated functions / types, regardless of how you actually import the package. I'm targeting ES2019 with my JavaScript in non-module mode, so all import statements get compiled down to require imports in the resulting JS files.

In the readme I specified it was require based import because the readme was just a JS example, and this lib is (likely) used far more for JS projects then TS projects. But thanks for the idea! I'll put a note in the readme clarifying that you can use import statements for it as well ^^