Skip to content

Typescript: Missing Type (Buffer) for SSL Configuration (key, cert. ca) for 'ConnectionOptions' type #92

@happyoka

Description

@happyoka

Describe the bug
Type 'Buffer' is not assignable to type 'string'.ts(2322)
connection.d.ts(199, 3): The expected type comes from property 'key' which is declared here on type 'ConnectionOptions'

To Reproduce
Steps to reproduce the behavior:

const connectionOptions : ConnectionOptions = {
    host: '192.168.80.90',
    port: 5671,
    transport: 'tls',
    servername: 'root',
    reconnect: true,
    key: fs.readFileSync(path.resolve(__dirname,'../client.key')),
    cert: fs.readFileSync(path.resolve(__dirname,'../client-cert.pem')),
    ca: fs.readFileSync(path.resolve(__dirname,'../server.pem')),
    rejectUnauthorized: false
 };

Expected behavior
No Linting error or typescript error

Package-version: 2.1.0
node.js version: v16.14.0
OS name and version: Window

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions