@@ -60,7 +60,7 @@ helpers.tests.ts:8:19 - error TS2345: Argument of type '"two"' is not assignable
6060Found 1 error.
6161```
6262
63- ### Let's make the same in JavaScript
63+ #### Let's make the same in JavaScript
6464
6565For the tests only the import change to ` *.js ` .
6666
@@ -81,11 +81,11 @@ export function square(number) {
8181}
8282```
8383
84- And our if we go back to the test now we do not see that ` square('two') ` is wrong :( .
84+ So if we now go back to the test we do not see that ` square('two') ` is wrong 😭 .
8585
8686![ 02-js-square-two] ( https://raw.githubusercontent.com/daKmoR/generate-typescript-definition-files-from-javascript/master/images/02-js-square-two.png )
8787
88- So that is the power of types. But we can make it work for JavaScript as well : hugs :
88+ So that is the power of types. But we can make it work for JavaScript as well 🤗
8989
9090Let's add types via JsDoc
9191
@@ -136,7 +136,7 @@ test/helpers.tests.js:8:19 - error TS2345: Argument of type '"two"' is not assig
136136Found 1 error.
137137```
138138
139- #### Enhancing our code
139+ ### Enhancing our code
140140
141141Let's assume we want to also add an offset (best I could come up with :see_no_evil : )
142142e.g.
@@ -148,7 +148,7 @@ expect(square(2, 'ten')).to.equal(14);
148148
149149First up ` TypeScript ` :
150150
151- ```
151+ ``` ts
152152export function square(number : number , offset = 0 ) {
153153 return number * number + offset ;
154154}
@@ -191,7 +191,7 @@ You will also want to provide those types to your users.
191191That means you will need to have ` *.d.ts ` files in the package you are publishing.
192192As those are the only files that ` TypeScript ` respects by default in the ` node_modules ` folder.
193193
194- ##### What does it means for TypeScript?
194+ #### What does it means for TypeScript?
195195
196196When we publish we will run ` tsc ` with these settings
197197
@@ -224,7 +224,7 @@ But it probably will be in the future. The original [issue](https://github.com/m
224224
225225And 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
227- > WARNING
227+ > ! WARNING!
228228> This is an unsupported version => if something does not work no one is going to fix it.
229229> Therefore if your use-case is not supported you will need to wait for the official release of TypeScript to support it.
230230
0 commit comments