# JSModule external class constructor

**URL:** <https://discuss.kotlinlang.org/t/jsmodule-external-class-constructor/29712>\
**Category:** JavaScript\
**Created:** [January 7, 2025, 9:58am UTC](https://discuss.kotlinlang.org/t/jsmodule-external-class-constructor/29712 "2025-01-07T09:58:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![meo209](https://avatars.discourse-cdn.com/v4/letter/m/d26b3c/32.png) [@meo209](https://discuss.kotlinlang.org/u/meo209)\
**Post date:** [January 7, 2025, 9:58am UTC](https://discuss.kotlinlang.org/t/jsmodule-external-class-constructor/29712/1 "2025-01-07T09:58:37Z")

</div>

The .d.ts file for the `Conn` class looks like this:

```typescript
export declare class Conn {
    constructor(botOptions: BotOptions, options?: Partial<ConnOptions>);
}

```

This is my MCProxy.kt:

```auto
@JsModule("@icetank/mcproxy")
@JsNonModule
external class Conn {
    constructor(botOptions: BotOptions)
}

```

When I try to use the Conn kotlin class by simply creating it, and supplying it with the botOptions, kotlin complains and says that `Conn is not a constructor`. Here is the full error:

```auto
    val conn = Conn(object : BotOptions {

TypeError: Conn is not a constructor

```

Here is the code I use to create the Conn object:

```kotlin
    val conn = Conn(object : BotOptions {
        override var host: String = "localhost"
        override var port: Int = 25565
        override var username: String = "MyBot"
    })

```
