{"action":"opened","issue":{"url":"https://api.github.com/repos/typings/typings/issues/670","repository_url":"https://api.github.com/repos/typings/typings","labels_url":"https://api.github.com/repos/typings/typings/issues/670/labels{/name}","comments_url":"https://api.github.com/repos/typings/typings/issues/670/comments","events_url":"https://api.github.com/repos/typings/typings/issues/670/events","html_url":"https://github.com/typings/typings/issues/670","id":172341224,"number":670,"title":"Unable to create definition for es6 class exported as default (facebook/dataloader)","user":{"login":"almilo","id":794497,"avatar_url":"https://avatars.githubusercontent.com/u/794497?v=3","gravatar_id":"","url":"https://api.github.com/users/almilo","html_url":"https://github.com/almilo","followers_url":"https://api.github.com/users/almilo/followers","following_url":"https://api.github.com/users/almilo/following{/other_user}","gists_url":"https://api.github.com/users/almilo/gists{/gist_id}","starred_url":"https://api.github.com/users/almilo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/almilo/subscriptions","organizations_url":"https://api.github.com/users/almilo/orgs","repos_url":"https://api.github.com/users/almilo/repos","events_url":"https://api.github.com/users/almilo/events{/privacy}","received_events_url":"https://api.github.com/users/almilo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-21T21:00:36Z","updated_at":"2016-08-21T21:00:36Z","closed_at":null,"body":"### Prerequisites\r\n\r\n* [X] Did you check the [FAQ](https://github.com/typings/typings/blob/master/docs/faq.md)?\r\n* [X] Did you search open **and closed** issues to see if your issue has already been reported?\r\n\r\n### Description\r\n\r\nI am trying to write a definition for [facebook/dataloader](https://github.com/facebook/dataloader) in oder to use it in a [TS project](https://github.com/almilo/annotated-graphql/blob/typescript/src/annotations/rest-schema-annotation.ts#L2).\r\nDataLoader seems to be a [es6 class exported as default](https://github.com/facebook/dataloader/blob/master/src/index.js#L42).\r\n\r\nAfter reading the [examples](https://github.com/typings/typings/blob/master/docs/examples.md) and other articles and issues, still cannot find the way to 'type' the default export and import it as any other class from TypeScript.\r\n\r\nI am using TS 1.8.10 with [this configuration](https://github.com/almilo/annotated-graphql/blob/typescript/tsconfig.json).\r\n\r\nI would like to write a definition like:\r\n \r\n```javascript\r\ndeclare module 'dataloader' {\r\n   // other types omitted \r\n\r\n    export class DataLoader<K, V> {\r\n        (batchLoadFn: BatchLoadFn<K, V>, options?: Options<K, V>): void;\r\n    }\r\n}\r\n```\r\n\r\nand use it like:\r\n \r\n```javascript\r\nimport {DataLoader} from 'dataloader';\r\n\r\nconst dataloader = new DataLoader(...);\r\n```\r\n\r\nWhat is not working as it seems that the import to use must be of the form:\r\n```javascript\r\nimport * as DataLoader from 'dataloader';\r\n```\r\nwhich seems to disallow the import of the class.\r\n\r\nThe question is 'how to write such a definition'? (for a es6 class transpiled into es5 as es6 module but exported as default).\r\nAlthough probably not a problem with typings itself, I think it would be great to add this case to the [examples](https://github.com/typings/typings/blob/master/docs/examples.md).\r\n\r\nThanks!!\r\nAlberto"}}
{"actor":{"display_login":"almilo"}}