diff --git a/README.md b/README.md index 7da7d1530b..c69d5135b5 100644 --- a/README.md +++ b/README.md @@ -149,14 +149,18 @@ and you may also add the `"jsx"` compiler option if your library needs it. DefinitelyTyped members routinely monitor for new PRs, though keep in mind that the number of other PRs may slow things down. +For a good example package, see [base64-js](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/types-2.0/base64-js). #### Common mistakes * First, follow advice from the [handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html). * Formatting: Either use all tabs, or always use 4 spaces. Also, always use semicolons, and use egyptian braces. * `interface X {}`: An empty interface is essentially the `{}` type: it places no constraints on an object. -* `interface Foo { new(): Foo }`: +* `interface IFoo {}`: Don't add `I` to the front of an interface name. +* `interface Foo { new(): Foo; }`: This defines a type of objects that are new-able. You probably want `declare class Foo { constructor(); } +* `const Class: { new(): IClass; }`: + Prefer to use a class declaration `class Class { constructor(); }` instead of a new-able constant. * `namespace foo {}`: Do not add a namespace just so that the `import * as foo` syntax will work. If it is commonJs module with a single export, you should use the `import foo = require("foo")` syntax. @@ -194,7 +198,7 @@ Changes to the `master` branch are also manually merged into the `types-2.0` bra #### I'm writing a definition that depends on another definition. Should I use `` or an import? -If the module you're referencing is an written as an external module (uses `export`), use an import. +If the module you're referencing is an external module (uses `export`), use an import. If the module you're referenceing is an ambient module (uses `declare module`, or just declares globals), use ``. #### What do I do about older versions of typings?