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

Typescript typings have no default export #533

Closed
firsttris opened this Issue Oct 29, 2017 · 5 comments

Comments

3 participants
@firsttris
Contributor

firsttris commented Oct 29, 2017

Holla,
before it was possible to import react-day-picker in typescript using the following construct:

import DayPicker from 'react-day-picker';

In version 6.2.1 the tsc compiler complains that 'react-day-picker' has no default export.

image

but if a change:

// **\node_modules\react-day-picker\types\index.d.ts
// TypeScript Version: 2.2

import { DayPicker } from "./DayPicker";
// We need to use 'export =' to be compatible with the 'module.exports = DayPicker.default || DayPicker' syntax
// in DayPicker.js in the final NPM package.
export = DayPicker;

to

// **\node_modules\react-day-picker\types\index.d.ts
// TypeScript Version: 2.2

import { DayPicker } from "./DayPicker";
// We need to use 'export =' to be compatible with the 'module.exports = DayPicker.default || DayPicker' syntax
// in DayPicker.js in the final NPM package.
export default DayPicker;

the import is working again.
Im using 6.2.1 with the integrated typings.

whats the correct way to import in typescript ?

regards
Tristan

@gpbl gpbl added the src:TypeScript label Oct 29, 2017

@PeterKottas

This comment has been minimized.

Show comment
Hide comment
@PeterKottas

PeterKottas Nov 5, 2017

This is definitely broken/undocumented. I see the same problem.

PeterKottas commented Nov 5, 2017

This is definitely broken/undocumented. I see the same problem.

@firsttris

This comment has been minimized.

Show comment
Hide comment
@firsttris

firsttris Nov 12, 2017

Contributor

Currently its possible to use import DayPicker = require('react-day-picker'); to get working typings with 6.2.1

Contributor

firsttris commented Nov 12, 2017

Currently its possible to use import DayPicker = require('react-day-picker'); to get working typings with 6.2.1

@gpbl gpbl changed the title from typescript typings no default export to Typescript typings have no default export Nov 24, 2017

@gpbl

This comment has been minimized.

Show comment
Hide comment
@gpbl

gpbl Nov 24, 2017

Owner

#539 has a longer discussion which I'd like to link here.

Owner

gpbl commented Nov 24, 2017

#539 has a longer discussion which I'd like to link here.

@gpbl

This comment has been minimized.

Show comment
Hide comment
@gpbl

gpbl Nov 24, 2017

Owner

I'd just plan a major release with the right export. I'd like also to remove the common.js default exports which are the root of all the problems 😄

Owner

gpbl commented Nov 24, 2017

I'd just plan a major release with the right export. I'd like also to remove the common.js default exports which are the root of all the problems 😄

@gpbl gpbl modified the milestones: v8.0.0, v7.0.0 Nov 24, 2017

gpbl added a commit that referenced this issue Nov 24, 2017

gpbl added a commit that referenced this issue Nov 25, 2017

@gpbl

This comment has been minimized.

Show comment
Hide comment
@gpbl

gpbl Nov 25, 2017

Owner

c221e2d should fix the issues

Owner

gpbl commented Nov 25, 2017

c221e2d should fix the issues

@gpbl gpbl closed this in #567 Nov 25, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment