TypeScript Version: 2.4.0 / nightly (2.5.0-dev.201xxxxx)
Code
var cred = new PasswordCredential({
id: '1234',
password: '1234'
})
Expected behavior:
PasswordCredential {idName: "username", passwordName: "password", additionalData: null, name: "", iconURL: ""…}
Actual behavior:
a mistake
Where did you define PasswordCredential in an interface or a class?
I would not know how to define it, I just want to be able to use this new language feature https://developer.mozilla.org/en-US/docs/Web/API/PasswordCredential
Experimental features are generally not included in the libraries until the point where the get general browser support. You would have to acquire the types from somewhere or create them yourself.
I've been looking for some interface that can serve me, but for now I find nothing u.u
So you will have to create your own...
declare global {
interface PasswordCredentialConstructor {
// stuff
}
interface PasswordCredential {
// stuff
}
const PasswordCredential: PasswordCredentialConstructor;
}
Fine my friend, let me see what I can do
thanks for your attention n.n
Did anyone find solution ?
@ahmedwaleed1: Yes, @kitsonk answered, you have to define the interface yourself so TypeScript is aware about this type. If you did not see it as a response, then you probably need to read https://www.typescriptlang.org/docs/handbook/interfaces.html
@ahmedwaleed1,
I got same issue, i just put declare var PasswordCredential: any; above the class. It got resolved
Most helpful comment
@ahmedwaleed1,
I got same issue, i just put declare var PasswordCredential: any; above the class. It got resolved