-
Notifications
You must be signed in to change notification settings - Fork 92
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
ES6-style import declarations don't work in TypeScript #88
Labels
Comments
I know basically nothing about post-2012 JavaScript. Help me out? |
I'm not 100% sure what's happening yet either; still investigating. |
import * as ipaddr from 'ipaddr.js';
// this filename should have .d.ts extension
declare module 'ipaddr.js' {
type IPVersion = "ipv4" | "ipv6";
interface IPAddr {
type: () => IPVersion;
octet: number[];
}
interface IPAddrModule {
parse: (ip: string) => IPAddr
}
const module: IPAddrModule;
export = module;
} |
I opened #93 to get type definitions added to this project. Email me if you want a more complete definition than above. |
#93 should have fixed this. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment: Typescript@2.5.2
The
tsconfig.json
used for this was:Mostly, I was surprised that the library isn't recognized as a module unless imported via
require
. This also makes declaring a.d.ts
file more difficult; the one I'd started worked with the ES6-style import but not with therequire
declaration.The text was updated successfully, but these errors were encountered: