功能参数导出为任何

时间:2019-05-21 12:37:00

标签: typescript

我试图将函数导出为npm包,但是我的函数参数的行为就像它们是任何类型一样

/user/types.ts

export interface UserCredentials {
    username: string;
    password: string;
}

/user/index.ts

import { login } from './actions';
import { UserCredentials } from 'types';

export function Login(userCreds: UserCredentials) {
    return login.request(userCreds);
}

/index.ts

export { Login } from '/user/index';

在/index.ts中,我希望函数具有类型userCreds的参数UserCredentials,但是函数具有类型userCreds的参数any

0 个答案:

没有答案