Skip to content

Commit 2e37875

Browse files
committed
Fix type errors introduced by typescript upgrade
1 parent 1af276b commit 2e37875

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

packages/authgear-core/src/base64.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { encode, decode } from "base64-arraybuffer";
22

3+
type Base64Input = ArrayBuffer | ArrayBufferView;
4+
35
/**
46
* @internal
57
*/
6-
export function _base64URLEncode(arrayBuffer: ArrayBuffer): string {
7-
return encode(arrayBuffer)
8+
export function _base64URLEncode(input: Base64Input): string {
9+
return encode(input as ArrayBuffer)
810
.replace(/\//g, "_")
911
.replace(/\+/g, "-")
1012
.replace(/=+$/, "");

packages/authgear-web/src/pkce.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ async function windowCryptoSubtleDigest(
77
algorithm: string,
88
data: Uint8Array
99
): Promise<Uint8Array> {
10-
const promiseOrEvent = window.crypto.subtle.digest(algorithm, data.buffer);
10+
const promiseOrEvent = window.crypto.subtle.digest(
11+
algorithm,
12+
data.buffer as ArrayBuffer
13+
);
1114
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
1215
if (promiseOrEvent.then) {
1316
return promiseOrEvent.then((output: ArrayBuffer) => {

0 commit comments

Comments
 (0)