Skip to content

Commit 42cd50b

Browse files
committed
chore: small adoptions
1 parent 63b4cfe commit 42cd50b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ helpers.tests.ts:8:19 - error TS2345: Argument of type '"two"' is not assignable
6060
Found 1 error.
6161
```
6262

63-
### Let's make the same in JavaScript
63+
#### Let's make the same in JavaScript
6464

6565
For 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

9090
Let'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
136136
Found 1 error.
137137
```
138138

139-
#### Enhancing our code
139+
### Enhancing our code
140140

141141
Let's assume we want to also add an offset (best I could come up with :see_no_evil:)
142142
e.g.
@@ -148,7 +148,7 @@ expect(square(2, 'ten')).to.equal(14);
148148

149149
First up `TypeScript`:
150150

151-
```
151+
```ts
152152
export 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.
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.
193193

194-
##### What does it means for TypeScript?
194+
#### What does it means for TypeScript?
195195

196196
When 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

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

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

Comments
 (0)