You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These type definitions allow TypeScript to understand Node.js APIs and provide proper type checking and autocompletion when you use functions like `fs.readFile` or `http.createServer`. For example:
72
72
73
-
```js
74
-
import*asfsfrom'fs';
75
-
76
-
fs.readFile('example.txt', foo, (err, data) => {
77
-
// ^^^
78
-
// Argument of type '"foo"' is not assignable to parameter of type …
79
-
if (err) {
80
-
throw err;
81
-
}
82
-
console.log(data);
83
-
});
73
+
<!-- prettier-ignore -->
74
+
```ts
75
+
// @noErrors
76
+
/* eslint-disable */
77
+
// ---cut---
78
+
importfsfrom'fs';
79
+
80
+
fs.read
81
+
// ^|
84
82
```
85
83
86
84
Many popular JavaScript libraries have their type definitions available under the `@types` namespace, maintained by the DefinitelyTyped community. This enables seamless integration of existing JavaScript libraries with TypeScript projects.
0 commit comments