Skip to content
This repository has been archived by the owner on Sep 4, 2019. It is now read-only.

Index.d.ts has a lack of return-type annotation #238

Closed
1 task done
eakarpov opened this issue Jan 12, 2018 · 1 comment
Closed
1 task done

Index.d.ts has a lack of return-type annotation #238

eakarpov opened this issue Jan 12, 2018 · 1 comment

Comments

@eakarpov
Copy link

Steps to reproduce

  • Install feathers client via npm i --save feathers-client
  • write a connection script via the guide
  1. Then
import * as io from 'socket.io-client';
import * as hooks from 'feathers-hooks';
import socketio from '@feathersjs/socketio-client';
// I tried to use "import * as socketio" too
import * as authentication from 'feathers-authentication-client';
import { Connection } from './lib/config/connection';
import * as feathers from 'feathers-client';

const socket: SocketIOClient.Socket = io(`${Connection.Protocol}://${Connection.Host}:${Connection.Port}`);
const client: FeathersApp = feathers(); // FeathersApp is not exported

client.configure(hooks());
client.configure(socketio(socket));
client.configure(authentication({
  storage: window.localStorage,
}));

export default client;

Function call socketio(socket) throws error:
"Cannot invoke an expression whose type lacks a call signature. Type 'typeof '@feathersjs/socketio-client'' has no compatible call signatures."

Package @feathersjs/socketio-client has also no declaration file in itself. I had to copy it from the feathers-typescript in my local index.d.ts

  • Tell us what broke. The more detailed the better.

Expected behavior

I should be able to use types from the library and should not have "any" types in function parameters and outputs.

Actual behavior

Many of lib functions use "any" type for parameters and outputs and the lib does not export types, only a value.

System configuration

Module versions (especially the part that's not working):
2.4.0
NodeJS version:
8.9.4
Operating System:
Ubuntu 16.04.3
Browser Version:
Mozilla Firefox 57.0.4
Module Loader:
"awesome-typescript-loader": "^3.4.1"

@daffl
Copy link
Member

daffl commented Jan 12, 2018

There is no index.d.ts in the current version (3.1.2) of this repository. Latest TypeScript definitions (where this issue is probably fixed) are currently under review at DefinitelyType (see https://github.com/feathersjs-ecosystem/feathers-typescript/issues/7).

@daffl daffl closed this as completed Jan 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants