docs(readme): Add hint about prettier ignore (#41593)

This is an aftermath of problem discussed here:
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/41567#discussion_r365882974

Thanks!
This commit is contained in:
Piotr Błażejewicz (Peter Blazejewicz)
2020-01-17 17:43:24 +01:00
committed by Eli Barzilay
parent 1d62b8f95f
commit 699dd6b2e2

View File

@@ -182,7 +182,11 @@ For a good example package, see [base64-js](https://github.com/DefinitelyTyped/D
#### Common mistakes
* First, follow advice from the [handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html).
* Formatting: Use 4 spaces. Prettier is set up on this repo, so you can run `npm run prettier -- --write path/to/package`.
* Formatting: Use 4 spaces. Prettier is set up on this repo, so you can run `npm run prettier -- --write path/to/package`. [When using assertions](https://github.com/SamVerschueren/tsd#assertions), add `// prettier-ignore` exclusion to mark line(s) of code as excluded from formatting:
```tsx
// prettier-ignore
const incompleteThemeColorModes: Theme = { colors: { modes: { papaya: { // $ExpectError
```
* `function sum(nums: number[]): number`: Use `ReadonlyArray` if a function does not write to its parameters.
* `interface Foo { new(): Foo; }`:
This defines a type of objects that are new-able. You probably want `declare class Foo { constructor(); }`.