-
Notifications
You must be signed in to change notification settings - Fork 13k
Description
TypeScript Version:
1.8.9
Code
Example 1
crypto.subtle.sign(
{
name: 'ECDSA',
hash: {
name: 'SHA-256'
}
},
privateKey,
arrayBuffer
);
Expected behavior:
It is acceptable for the first argument to be an object. Should compile.
Actual behavior:
Error TS2345: Argument of type '{ name: string; hash: { name: string; }; }' is not assignable to parameter of type 'string | Algorithm'. Object literal may only specify known properties, and 'hash' does not exist in type 'string | Algorithm'.
Example 2
crypto.subtle.generateKey(
{
name: 'ECDSA',
namedCurve: 'P-256'
},
false,
['sign']
);
Expected behavior:
It is acceptable for the first argument to be an object. Should compile.
Actual behavior:
Error TS2345: Argument of type \'{ name: string; namedCurve: string; }\' is not assignable to parameter of type \'string | Algorithm\'.\n Object literal may only specify known properties, and \'namedCurve\' does not exist in type \'string | Algorithm\'.
Example 3
crypto.subtle.verify(
{
name: 'ECDSA',
hash: {
name: 'SHA-256'
}
},
publicKey,
signature,
arrayBuffer
);
Expected behavior:
It is acceptable for the first argument to be an object. Should compile.
Actual behavior:
Error TS2345: Argument of type \'{ name: string; hash: { name: string; }; }\' is not assignable to parameter of type \'string | Algorithm\'.\n Object literal may only specify known properties, and \'hash\' does not exist in type \'string | Algorithm\'.
Example 4
crypto.subtle.importKey('spki', spki, {
name: 'ECDSA',
namedCurve: 'P-256'
}, true, ['verify']);
Expected behavior:
It is acceptable for the third argument to be an object. Should compile.
Actual behavior:
Error TS2345: Argument of type \'{ name: string; namedCurve: string; }\' is not assignable to parameter of type \'string | Algorithm\'.\n Object literal may only specify known properties, and \'namedCurve\' does not exist in type \'string | Algorithm\'.