Rudeg / react-input-calendar

http://rudeg.github.io/react-input-calendar/
MIT License
139 stars 94 forks source link

check typescript definitions #30

Closed stepancar closed 9 years ago

stepancar commented 9 years ago

Hello! Thank you for this calendar! I added defintions for typescript please, check definitions for your library if all correct - add comment that all ok Thank you!

Rudeg commented 9 years ago

Hello, it's okey.

abelski21 commented 6 years ago

Hi @stepancar I'm using the typed definition in my project, but I keep getting an error on rendering. I'm trying to import the component but it says there has no default export.

Here's how I import the component: import ReactInputCalendar from 'react-input-calendar';

I tried this way as well import * as ReactInputCalendar from 'react-input-calendar';

But I'm getting a console error on rendering Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.

Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

Here's the entire code in my component:

import * as React from "react";
import {observer} from "mobx-react";
import * as ReactInputCalendar from 'react-input-calendar';

import KonaComponent from "../KonaComponent/KonaComponent";

interface Props {
  date?: string | Date;
  startDate?: string | Date;
  endDate?: string | Date;
  format?: string;
  onChange?: (date: string) => void;
  placeholder?: string;
}

@observer
export default class DatePicker extends KonaComponent<Props> {
  render(): any {
    const {date, startDate, endDate, format, onChange, placeholder} = this.props;
    return (
      <div>
        <ReactInputCalendar date={date} placeholder={placeholder} />  
      </div>

    );
  }
}
stepancar commented 6 years ago

@abelski21 , as I understand, definitions is obsolete. I will try to update it at next week. But its free to send PR. I can help you with review