Skip to content

Commit bddb6fa

Browse files
committed
Update the documentation to make it clearer how to use the library in a pure JavaScript environment (#120)
1 parent ef1372a commit bddb6fa

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

readme.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ Demo: https://smartscheduling.com/en/documentation/autocomplete
44

55
## Installation
66

7-
If you want to use the library in browser, just include the `autocomplete.js` and `autocomplete.css` into your HTML file.
7+
If you want to use the library in a browser, just include `autocomplete.js` and `autocomplete.css` in your HTML file.
88

99
For `node.js`:
1010

1111
```console
1212
npm install autocompleter
1313
```
1414

15-
Then import it into your javascript code:
15+
Then import it into your JavaScript code:
1616

1717
```javascript
1818
import autocomplete from "autocompleter";
@@ -50,13 +50,13 @@ autocomplete({
5050

5151
## Use with Typescript and Webpack
5252

53-
Simply import the autocompleter in your typescript file:
53+
Simply import the autocompleter in your TypeScript file:
5454

5555
```javascript
5656
import autocomplete from "autocompleter";
5757
```
5858

59-
and call the `autocomplete` function as showed below:
59+
Then call the `autocomplete` function as shown below:
6060

6161
```javascript
6262
// replace the `MyInterface` interface with the interface you want to use with autocomplete
@@ -73,7 +73,7 @@ autocomplete<MyInterface>({
7373
});
7474
```
7575

76-
If your custom interface doesn't have the `label` property, you might get a compilation error from typescript. In this case just add an additional type to your code and pass it to the autocompleter:
76+
If your custom interface lacks the `label` property, TypeScript may produce a compilation error. To avoid this, use an additional type:
7777

7878
```javascript
7979
import autocomplete, { AutocompleteItem } from 'autocompleter';
@@ -99,7 +99,7 @@ autocomplete<MyItem>({
9999
});
100100
```
101101

102-
If your interface doesn't have a `label` property, you also have to provide a custom render function.
102+
If your interface lacks a `label` property, you must provide a custom render function.
103103

104104
## Options
105105

@@ -270,6 +270,10 @@ autocomplete({
270270

271271
[Try online](https://jsbin.com/fololajava/edit?html,js,output)
272272

273+
## Using the Library in a Pure JavaScript Environment
274+
275+
If you're using this library in a pure JavaScript environment, note that TypeScript enums are transpiled into numeric values. As a result, named enum values are replaced with their corresponding numbers. When calling functions that expect enum values, make sure to pass the correct numeric value instead of the enum name.
276+
273277
## License
274278

275279
Autocomplete is released under the MIT License.

0 commit comments

Comments
 (0)