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

Update TypeScript.md #4126

merged 6 commits into from Jul 11, 2022

Conversation

mikicho
Copy link
Contributor

@mikicho mikicho commented Jul 9, 2022

Fix #4122

Checklist

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Jul 9, 2022
Copy link
Member

@climba03003 climba03003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to elaborate more on this area.

TypeScript can only identify the types that are direct imported in code which means that you can use require inline with import on top.

For example,

import 'plugin' // here will trigger the type augmentation.

fastify.register(require('plugin'))

import plugin from 'plugin' //  here will trigger the type augmentation.
fastify.register(plugin)

Or even explicit config on tsconfig

{
  "types": ["plugin"] // we force TypeScript to import the types
}

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mikicho
Copy link
Contributor Author

mikicho commented Jul 9, 2022

@climba03003 WDYT?

Copy link
Member

@climba03003 climba03003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Except the line need to be formatted and break in length 80.

@climba03003 climba03003 requested a review from Fdawgs July 9, 2022 19:59
docs/Reference/TypeScript.md Outdated Show resolved Hide resolved
docs/Reference/TypeScript.md Outdated Show resolved Hide resolved
docs/Reference/TypeScript.md Outdated Show resolved Hide resolved
mikicho and others added 3 commits July 10, 2022 19:33
Co-authored-by: Frazer Smith <frazer.dev@outlook.com>
Co-authored-by: Frazer Smith <frazer.dev@outlook.com>
Co-authored-by: Frazer Smith <frazer.dev@outlook.com>
@mikicho
Copy link
Contributor Author

mikicho commented Jul 10, 2022

Thanks! @Fdawgs

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 12, 2023
@mikicho mikicho deleted the patch-1 branch July 12, 2023 05:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plugins must be imported at the top to propagate the types
5 participants