In the documentation for the Cassandra driver, they provide code examples like this:
const Uuid = require('cassandra-driver').types.Uuid;
const id = Uuid.random();
However, when attempting to use this in Visual Studio Code, the Uuid
class type is not recognized.
https://i.sstatic.net/Xs3dy.png
I tried using ES6 style imports like this:
import cassandra from 'cassandra-driver'
How can I properly import the Uuid
type so that typescript recognizes it correctly?
Using a type alias seemed to initially solve the issue. Is this the recommended approach? It feels a bit verbose if I need to do this for multiple types.
type Uuid = cassandra.types.Uuid
Update: Unfortunately, using a type alias did not fully resolve the problem as I was unable to call Uuid.fromString(...)
.