Skip to content

Commit 77fdea4

Browse files
committed
chore: typos
1 parent ce5d055 commit 77fdea4

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ I am a little afraid that I am not going to do TypeScript justice.
1010
The reason for that is that we are going to use it heavily - but in a rather indirect way.
1111

1212
See - we are a big fan of a [buildless]() development setup. We have [a post]() or [two]() about it :grimmacing:
13-
It is [our believe](https://open-wc.org/about/rationales.html) that it is the best way to bring developers (you) and the platform (browser) back on the same table.
13+
It is [our belief](https://open-wc.org/about/rationales.html) that it is the best way to bring developers (you) and the platform (browser) back on the same table.
1414

15-
Knowing this makes it hard to root for TypeScript as it is a [Transpiler Language]() - in other words it requires a build step.
15+
Knowing this makes it hard to root for TypeScript as it is a [Transpiler Language]() - in other words, it requires a build step.
1616

1717
So how come we are still fans?
1818
Let's dive into and see what Types can give you.
@@ -40,11 +40,11 @@ export function square(number: number) {
4040

4141
So yeah I know what you have been thinking - a string as an argument?
4242
While implementing we found out that it was a bad idea.
43-
And thanks to the power of types we can just go back to our code/tests and tada we immeditelly see in vscode that `square('two')` is not working.
43+
And thanks to the power of types we can just go back to our code/tests and tada we immediately see in vscode that `square('two')` is not working.
4444

4545
![01-ts-square-two](https://github.com/daKmoR/generate-typescript-definition-files-from-javascript/blob/master/images/01-ts-square-two.png)
4646

47-
And we will of course get the same if we try to run `tsc`.
47+
And we will, of course, get the same if we try to run `tsc`.
4848

4949
```bash
5050
npm i -D typescript
@@ -72,7 +72,7 @@ expect(square(2)).to.equal(4);
7272
expect(square('two')).to.equal(4);
7373
```
7474

75-
For the code we removed the type
75+
For the code, we removed the type
7676

7777
```js
7878
// helpers.js
@@ -87,7 +87,7 @@ And our if we go back to the test now we do not see that `square('two')` is wron
8787

8888
So that is the power of types. But we can make it work for JavaScript as well :hugs:
8989

90-
Let's add a types via JsDoc
90+
Let's add types via JsDoc
9191

9292
```js
9393
/**
@@ -120,11 +120,11 @@ and configure TypeScript to check for JavaScript as well by adding a `tsconfig.j
120120
}
121121
```
122122

123-
Doing this allows as to get exaclty the same behavior in VSCode as with TypeScript.
123+
Doing this allows as to get exactly the same behaviour in VSCode as with TypeScript.
124124

125125
![03-js-square-two-typed](https://github.com/daKmoR/generate-typescript-definition-files-from-javascript/blob/master/images/03-js-square-two-typed.png)
126126

127-
We even get the same behavior when running `tsc`.
127+
We even get the same behaviour when running `tsc`.
128128

129129
```bash
130130
$ npx tsc
@@ -168,7 +168,7 @@ export function square(number, offset = 0) {
168168
}
169169
```
170170

171-
In both cases it will give
171+
In both cases, it will give
172172

173173
```bash
174174
test/helpers.tests.js:13:22 - error TS2345: Argument of type '"ten"' is not assignable to parameter of type 'number'.
@@ -177,7 +177,7 @@ test/helpers.tests.js:13:22 - error TS2345: Argument of type '"ten"' is not assi
177177
~~~~~
178178
```
179179

180-
Also in both cases the only thing we needed to add was `offset = 0` as it contains the type information already.
180+
Also in both cases, the only thing we needed to add was `offset = 0` as it contains the type information already.
181181

182182
If you wanna know more about how to use JSDoc for types I can recommend you these blog posts.
183183

@@ -186,7 +186,7 @@ If you wanna know more about how to use JSDoc for types I can recommend you thes
186186

187187
### Publishing a library
188188

189-
If someone is to use your code you will need to publish it. Usually that happens on npm.
189+
If someone is to use your code you will need to publish it. Usually, that happens on npm.
190190
You will also want to provide those types to your users.
191191
That means you will need to have `*.d.ts` files in the package you are publishing.
192192
As those are the only files that `TypeScript` respects by default in the `node_modules` folder.
@@ -220,13 +220,13 @@ e.g. the output of the js file is exactly the same we wrote in our js version.
220220
#### What does it means for JavaScript?
221221

222222
Sadly as of now `tsc` does not support generating `*.d.ts` files from JSDoc annotated files.
223-
But it probably will be in the future. The original [issue](https://github.com/microsoft/TypeScript/issues/7546) is from 2016 but recently it has been said was planned for `3.6` (but it didn't make it into beta) so it seems it on the board for for `3.7`. However don't take my word for it as here is a working [Pull Request](https://github.com/microsoft/TypeScript/pull/32372).
223+
But it probably will be in the future. The original [issue](https://github.com/microsoft/TypeScript/issues/7546) is from 2016 but recently it has been said was planned for `3.6` (but it didn't make it into beta) so it seems it on the board for `3.7`. However, don't take my word for it as here is a working [Pull Request](https://github.com/microsoft/TypeScript/pull/32372).
224224

225225
And it is working so great that we are using it even in production for [open-wc](https://github.com/open-wc/open-wc/blob/master/package.json#L7).
226226

227227
> WARNING
228228
> This is an unsupported version => if something does not work no one is going to fix it.
229-
> Therefore if your usecase is not supported you will need to wait for the offical release of TypeScript to support it.
229+
> Therefore if your use-case is not supported you will need to wait for the official release of TypeScript to support it.
230230
231231
So you have been warned if you still think it's a good idea to test it you feel free to do so.
232232
We published a forked version [typescript-temporary-fork-for-jsdoc](https://www.npmjs.com/package/typescript-temporary-fork-for-jsdoc) which is just a copy of what the above Pull Request is providing. (again to be clear - we did not change anything it is a temporary fork which is good enough for our use case).
@@ -266,7 +266,7 @@ Congratulations you now have a type safety without a build step :tada:
266266

267267
It comes down two 2 things
268268

269-
- Typings can be immensely useful (type safety, auto complete, documentation, ...) for you and/or your users
269+
- Typings can be immensely useful (type safety, auto-complete, documentation, ...) for you and/or your users
270270
- TypeScript is very flexible and supports types for "just" JavaScript as well
271271

272272
Follow us on [Twitter](https://twitter.com/openwc), or follow me on my personal [Twitter](https://twitter.com/dakmor).

0 commit comments

Comments
 (0)