Comments (8)
There is no elegant way to solve this except by rewriting the library in Typescript. Typescript doesn't let users use JSDoc when using Typescript. Conversion tools exist but they are either not maintained well or don't work well enough.
This is not as crazy as it sounds because everything is already strictly typed using JSDoc. Should be straightforward, let's go this way, work has already started.
from basic-ftp.
The source itself defines types using JSDoc sufficiently to satisfy even strict
and noImplicitAny
compiler settings. In VSCode, just using checkJs
with a regular Javascript project works well.
But I haven't tested this with an actual Typescript project. I will have a look but I want to make it work using JSDoc only.
from basic-ftp.
It is actually written in JS. I am not able to use the types correctly in JSDoc.
const ftp = require("basic-ftp");
Should it be
/**
* @type {typeof ftp.Client}
*/
It would be interpreted as a normal function however.
or
/**
* @type {ftp.Client}
*/
This would become any
type.
The types are actually loaded but the notice still shows up. Should it be an issue of
TypeScript and JavaScript Language Features vscode.typescript-language-features
instead?
from basic-ftp.
Javascript projects should work fine, no? Using the following two lines with "javascript.implicitProjectConfig.checkJs": true
works fine in VSCode: It shows an error for my first argument when trying to instantiate ftp.Client.
const ftp = require("basic-ftp")
const bla = new ftp.Client("VSCode SHOULD MARK ERROR HERE");
from basic-ftp.
But it looks like there's something missing for Typescript projects. I will look into it.
from basic-ftp.
@patrickjuchli hi, i think the best way to solve this issue would be adding native typings to repo. Im talking about index.d.ts
file which defines package typings. That will significantly help to use basic-ftp in typescript projects.
Anyway, i'd happy to make pull request with described feature.
from basic-ftp.
There are some open issues on the Typescript repository about leveraging JSDoc annotations instead of having to specify type definitions a second time. It seems they want to support that. In the short term, we probably do need a d.ts
type definition file. I don't like the idea of having two separate type definitions for the same things, though. Go ahead with the pull request if you want to give it a try.
from basic-ftp.
Fixed in 3.2.0
from basic-ftp.
Related Issues (20)
- 451-Transfer aborted with small file HOT 4
- Send response on closewitherror on FTContext HOT 1
- SFTP Timeout (control socket) HOT 1
- Question: configuration for tls? HOT 1
- List function only prints current working directory when provided with optional path parameter HOT 2
- Timeout catch HOT 2
- Question: Does this library support insecure FTP connection? HOT 4
- How can i check with IF clause when using uploadfrom HOT 2
- QUESTION: ECONNRESET FTPS and FTPES HOT 1
- Add full file path in info from trackProgress HOT 1
- uploadfrom and appendFrom TypeError: source.once is not a function HOT 4
- Immutable files on server HOT 1
- Active FTP HOT 1
- ECONNRESET when uploading multiple files HOT 1
- White space is file and folder names HOT 8
- there is an error on bun HOT 3
- Question: How can I get this to work on Windows HOT 3
- Download images from FTP HOT 1
- Memory leak in Client HOT 13
- Integration of active FTP
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from basic-ftp.