Property 'randomBytes' does not exist on type 'Crypto'

I’m following the code here to create a code_verifier in my Angular app:

function base64URLEncode(str) {
return str.toString('base64')
    .replace(/\+/g, '-')
    .replace(/\//g, '_')
    .replace(/=/g, '');
}
var verifier = base64URLEncode(crypto.randomBytes(32));

However I get Property 'randomBytes' does not exist on type 'Crypto' error as I believe crypto is now a native browser object and the function doesn’t exist. Should I be using the native browser object and getRandomValues() or still try and use the node module, which doesn’t seem to available client (browser) side, or do something else, or use Implicit Flow, which wasn’t recommended for a SPA?

I’ve since discovered the Auth0 Single Page App SDK implements Authorization Code Grant with PKCE under the hood and I don’t need to worry about these lower level implementation tasks.