0
export declare const TerminalWidgetOptions; unique synbol;
export interface TerminalWidgetOptions {
    endpoint: Endpoint.Options,
    id: string,
    caption: string,
    label: string
    destroyTermOnClose: boolean
}

With this code when I create a class implementing this interface, I get an error : error TS2507: Type 'unique symbol' is not a constructor function type.

I don't understand why TypeScript doesn't see the interface.

Is someone could explain me ?

NiGhMa
  • 121
  • 1
  • 6
  • 1
    Is the first line supposed to be `export const TerminalWidgetOptions: unique symbol`? Because, if so, I'm not sure what this code is trying to do. You declare a constant which is a symbol and an interface which is completely different both having the same name? Also, there is a `const` but it's not assigned to anything. – VLAZ Mar 15 '21 at 14:16
  • I forgot there is a declare front of the const and I have to use this code but it's not mine. I try to implement the interface – NiGhMa Mar 15 '21 at 14:29
  • Does this answer your question? [TypeScript variable name as interface type?](https://stackoverflow.com/questions/49798156/typescript-variable-name-as-interface-type) – Linda Paiste Mar 16 '21 at 02:05
  • 1
    Let me reiterate what @VLAZ said. `const TerminalWidgetOptions; unique synbol;` MAKES NO SENSE, with or without `declare`. It's just a bunch of syntax errors. I found [the original code](https://stackoverflow.com/questions/49798156/typescript-variable-name-as-interface-type) and you are supposed be assigning a value to the `const` which is a `Symbol` that you create by calling `Symbol("TerminalWidgetOptions")`. You are neither assigning a value nor creating a `Symbol`. Is this a code file or a declaration file? @glavigno's answer declares the `const` but doesn't create it. – Linda Paiste Mar 16 '21 at 02:09

1 Answers1

1

Did you try to declare it before defining and exporting it ?

declare const TerminalWidgetOptions: unique symbol;

export interface TerminalWidgetOptions {
    endpoint: Endpoint.Options;
    id: string;
    caption: string;
    label: string;
    destroyTermOnClose: boolean;
}

I referred to the official documentation.

glavigno
  • 483
  • 5
  • 10