Git Product home page Git Product logo

Comments (11)

supersnager avatar supersnager commented on July 29, 2024 10

Update: Work on the Typescript typings is in progress. It will be available soon :)

from chat-ui-kit-react.

supersnager avatar supersnager commented on July 29, 2024 4

Hey @zhan2016 I'm glad you asked. It will be available this week.

from chat-ui-kit-react.

valerii15298 avatar valerii15298 commented on July 29, 2024 3

Hello guys. Thank you for developing Such a Great project!!!
I also very much want Typescript to be used with this library so I can use it freely in my project. Also, I think a lot of other people will be interested in at least typescript definitions for this library(I personally cannot imagine how to work without autocomplete but this library will be exception:) ). So if you will have any updates, will be glad to hear that. Thank you.

from chat-ui-kit-react.

supersnager avatar supersnager commented on July 29, 2024 2

Hey @nzayatz14,
I'm glad you appreciate my work, mate!
I know Typescript is a must-have for this project.
Version 2.0 will definitely be rewritten to Typescript. I am not sure yet, but it is possible that as a temporary solution I will add typing in the first version...
BTW my second library for managing chat state is already written in Typescript. I hope it will be released tomorrow...

from chat-ui-kit-react.

supersnager avatar supersnager commented on July 29, 2024 2

Finally, there it is!

https://github.com/chatscope/chat-ui-kit-react/releases/tag/v1.9.1

(Please do not use version v1.9.0. It is buggy - it lacks type definition files :))

Sorry for the delay to everyone who waited so long for this.
I know the lack of types is annoying (for me too :) ).

Thank you for being so patient, my friends!

from chat-ui-kit-react.

valerii15298 avatar valerii15298 commented on July 29, 2024 2

@supersnager Thank you!
If you guys have(or will have In future) some problems with typescript I would like to contribute and help too.

from chat-ui-kit-react.

nzayatz14 avatar nzayatz14 commented on July 29, 2024 1

@supersnager no worries, I found a workaround for now but obviously not as nice as actual type definitions.

If you wanted to quickly add types without rewriting the entire project. You could just create a file chat-ui-kit-react.d.ts and have your declared export types in there. It looks like you already have a reasonable grasp on what types you want each prop to be based on your documentation.

I created a pretty bare-bones version of this where I just declared all of the components I was using as extensions of React.ComponentClass<any>. It allows for my local Typescript transpile without any issues, but I don't get any nice autocomplete or anything like that.

declare module "@chatscope/chat-ui-kit-react" {
	import * as React from 'react';

	interface Avatar extends React.ComponentClass<any> {

	}
	export const Avatar: Avatar;

	interface ChatContainer extends React.ComponentClass<any> {

	}
	export const ChatContainer: ChatContainer;

	interface ConversationHeader extends React.ComponentClass<any> {
                Back: any
		Content: any
                Actions: any
	}
	export const ConversationHeader: ConversationHeader;

        ...remaining components...
}

You can read more about this here: https://www.typescriptlang.org/docs/handbook/declaration-files/templates/module-d-ts.html

from chat-ui-kit-react.

supersnager avatar supersnager commented on July 29, 2024

@nzayatz14 Thanks for the advice, it will definitely come in handy.

from chat-ui-kit-react.

zhan2016 avatar zhan2016 commented on July 29, 2024

Hello guys. Thanks for your excellent work! Does typescript typings have a smooth work? when is it going to be available? @supersnager

from chat-ui-kit-react.

zhan2016 avatar zhan2016 commented on July 29, 2024

Thank you very much. Such a good news.

from chat-ui-kit-react.

Jak2k avatar Jak2k commented on July 29, 2024

Is it availble now?

from chat-ui-kit-react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.