Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update TypeScript.md #4126

Merged
merged 6 commits into from Jul 11, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/Reference/TypeScript.md
Expand Up @@ -643,10 +643,11 @@ Inheritance](https://dev.to/ethanarrowood/is-declaration-merging-and-generic-inh
#### Using a Plugin

Using a Fastify plugin in TypeScript is just as easy as using one in JavaScript.
Import the plugin with `import/from` and you're all set -- except there is one
exception users should be aware of.
Import the plugin with `import/from` and you're all set.

Fastify plugins use declaration merging to modify existing Fastify type
> Using `require` won't load the type definitions properly and may cause a type errors

One exception users should be aware of is that Fastify plugins use declaration merging to modify existing Fastify type
interfaces (check out the previous two examples for more details). Declaration
merging is not very _smart_, meaning if the plugin type definition for a plugin
is within the scope of the TypeScript interpreter, then the plugin types will be
Expand Down