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

Adding type definitions for React projects written in Typescript. #27

Open
sgruse opened this issue Apr 9, 2018 · 1 comment
Open

Comments

@sgruse
Copy link

sgruse commented Apr 9, 2018

It would be awesome to be able to use this module in my React Typescript application. In order to do this we need to add type definitions to the /dist directory. I believe this will also clear up the prior issue opened on this repository: #22.

I tried to submit a PR but was denied permission. Only three things need to happen for this to work.

1.) Adding this line to the package.json file: "types": "dist/index.d.ts"

2.) Adding this code to /src/index.ts

import * as React from 'react'
import * as moment from 'moment'

// Interfaces
interface ReactAddToCalendarProps {
	event: CalendarEventInterface
}

export interface CalendarEventInterface {
	title: string
	description: string
	location: string
	startTime: moment.Moment
	endTime: moment.Moment
}

// Declare the Module with accepted props.
declare class ReactAddToCalendar extends React.Component<ReactAddToCalendarProps, any> { }

export default ReactAddToCalendar

3.) Having the build command copy the src/index.d.ts file to the dist folder.

Please let me know if we can make this happen!

Thanks,
Sam Gruse
[email protected]

@jurajkocan
Copy link

@sgruse If you are missing type def, you can make your own
DefinetlyTyped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants