Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for TypeScript #43

Open
zoeleu opened this issue Mar 21, 2021 · 7 comments
Open

Add support for TypeScript #43

zoeleu opened this issue Mar 21, 2021 · 7 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@zoeleu
Copy link

zoeleu commented Mar 21, 2021

Typings serve for the TypeScript compiler to do type validations. Is it possible to make a typing for this library? Thanks.

@this-fifo this-fifo added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Mar 22, 2021
@this-fifo
Copy link
Owner

hey @matteoturini thanks for the suggestion, I have no problems accepting a PR with typings for this library and would welcome anybody to add support for this

it is not something I had planned originally, and I do not need it, so I'll leave it open for whoever wants to do it

@zoeleu
Copy link
Author

zoeleu commented Mar 22, 2021

hey @matteoturini thanks for the suggestion, I have no problems accepting a PR with typings for this library and would welcome anybody to add support for this

it is not something I had planned originally, and I do not need it, so I'll leave it open for whoever wants to do it

btw, IDE's like VSCode can highly profit from typescript typings too.

@this-fifo this-fifo changed the title No TypeScript typings Add support for TypeScript Mar 22, 2021
@Felix-Franz
Copy link
Contributor

You can use following typescript definition:

react-jutsu.d.ts:

declare module "react-jutsu" {
  import React, { ReactNode, ReactElement } from "react";
  export interface JutsuProps extends React.HTMLProps<HTMLDivElement> {
    
    // The meeting room name
    roomName: string;

    // The participant's displayed name
    displayName?: string;

    // The meeting room password
    password?: string;

    // Callback function executed after readyToClose event is fired
    onMeetingEnd?: () => void;

    // The meeting subject (what is displayed at the top)
    subject?: string;

    // Custom jitsi domain
    domain?: string;

    // component displayed while loading
    loadingComponent?: JSX.Element;
    
    // component displayed on error
    errorComponent?: JSX.Element;

    // Internally Jutsu is constructed inside 2 containers, you can add custom styles for each by specifying containerStyles and jitsiContainerstyles
    containerStyles?: CSSProperties;
    jitsiContainerStyles?: CSSProperties;

    // Configuration object to overwrite. Visit https://github.com/jitsi/jitsi-meet/blob/master/config.js
    configOverwrite?: any;
    
    // Interface configuration object to overwrite. Visit https://github.com/jitsi/jitsi-meet/blob/master/interface_config.js
    interfaceConfigOverwrite?: any;

    // Callback function to be called with an error as the only parameter if any.
    onError?: () => void;

    // Callback function to be called with the jitsi API client when instantiated.
    onJitsi?: () => void;

    // Any other prop passed to the component will be passed to jitsi API constructor as part of the options parameter.
    jwt?: any;
    devices?: any;
    userInfo?: any;
  }

  export const Jutsu: (props: JutsuProps) => ReactElement;
}

@zoeleu
Copy link
Author

zoeleu commented Jun 21, 2021

You can use following typescript definition:

react-jutsu.d.ts:

declare module "react-jutsu" {
  import React, { ReactNode, ReactElement } from "react";
  export interface JutsuProps extends React.HTMLProps<HTMLDivElement> {
    
    // The meeting room name
    roomName: string;

    // The participant's displayed name
    displayName?: string;

    // The meeting room password
    password?: string;

    // Callback function executed after readyToClose event is fired
    onMeetingEnd?: () => void;

    // The meeting subject (what is displayed at the top)
    subject?: string;

    // Custom jitsi domain
    domain?: string;

    // component displayed while loading
    loadingComponent?: JSX.Element;
    
    // component displayed on error
    errorComponent?: JSX.Element;

    // Internally Jutsu is constructed inside 2 containers, you can add custom styles for each by specifying containerStyles and jitsiContainerstyles
    containerStyles?: CSSProperties;
    jitsiContainerStyles?: CSSProperties;

    // Configuration object to overwrite. Visit https://github.com/jitsi/jitsi-meet/blob/master/config.js
    configOverwrite?: any;
    
    // Interface configuration object to overwrite. Visit https://github.com/jitsi/jitsi-meet/blob/master/interface_config.js
    interfaceConfigOverwrite?: any;

    // Callback function to be called with an error as the only parameter if any.
    onError?: () => void;

    // Callback function to be called with the jitsi API client when instantiated.
    onJitsi?: () => void;

    // Any other prop passed to the component will be passed to jitsi API constructor as part of the options parameter.
    jwt?: any;
    devices?: any;
    userInfo?: any;
  }

  export const Jutsu: (props: JutsuProps) => ReactElement;
}

mind pushing this into the repo?

Felix-Franz added a commit to Felix-Franz/jutsu that referenced this issue Jun 22, 2021
this-fifo added a commit that referenced this issue Jun 22, 2021
this-fifo added a commit that referenced this issue Jun 22, 2021
Include support for typescript typing definitions #43
@this-fifo
Copy link
Owner

Just published v3.0.3 with these typing definitions

@yyynnn
Copy link

yyynnn commented Aug 16, 2021

d.ts is absent from final build

Screenshot 2021-08-16 at 19 33 05

@this-fifo this-fifo reopened this Aug 17, 2021
@this-fifo
Copy link
Owner

thank you @yyynnn, it seems like it's missing a step in the rollup configuration to include that in the build, I'm accepting PRs if anyone is willing to take a shot at this, otherwise I can work on it when I have some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants