Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion sites/website/src/pages/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default function () {
<h3>Install the package</h3>
<CodeBlock>npm install @microsoft/fast-element</CodeBlock>

<h3>Create a web component</h3>
<h3>Create a web component in the file `hello-world.ts`</h3>
<CodeBlock language="typescript">
{`/*
* import utilities from @microsoft/fast-element
Expand Down Expand Up @@ -106,6 +106,20 @@ HelloWorld.define({
<CodeBlock language="html">
{`<hello-world name="Earth"></hello-world>`}
</CodeBlock>

<h3>Update your tsconfig.json file to support decorators</h3>
<CodeBlock language="json">
{{
"compilerOptions": {
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"module": "ESNext",
"moduleResolution": "bundler",
"target": "ES2020",
"useDefineForClassFields": false
}
}}
</CodeBlock>
Comment on lines +109 to +122
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for this! I do wonder if it makes sense to put the tsconfig implementation below install in scenarios where folks don't see it working right away without this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I haven't had a chance to pull down the PR and run it yet, but I think the minimum required tsconfig can be stripped down further from here.

Copy link
Author

Choose a reason for hiding this comment

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

I'm fine with the location of tsconfig being moved down on the page and with it being stripped it down to the minimum required.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good - to be clear, I think this can go above npm install just since it's "required configuration" right now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'll have some time today to pull down and provide a more thorough review. I appreciate your patience.

Comment on lines +111 to +122
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's currently an error with the contents of the code block, it needs to be wrapped in back ticks instead of a double curly brace. Whitespace is also preserved in the rendered output so the formatting needs to be adjusted.

The only suggestion I have is to remove emitDecoratorMetaData since it is not required in order to use FAST, only if you are creating a library with it and want TypeScript to create the runtime type information for your decorators and even then it is optional.

The required tsconfig can technically be reduced even further to just experimentalDecorators and useDefineForClassFields, however the other options do provide a good starting point for most projects.

Suggested change
<CodeBlock language="json">
{{
"compilerOptions": {
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"module": "ESNext",
"moduleResolution": "bundler",
"target": "ES2020",
"useDefineForClassFields": false
}
}}
</CodeBlock>
<CodeBlock language="json">
{`{
"compilerOptions": {
"experimentalDecorators": true,
"module": "ESNext",
"moduleResolution": "bundler",
"target": "ES2020",
"useDefineForClassFields": false
}
}`}
</CodeBlock>

</section>

<div role="separator" className="section-decoration"></div>
Expand Down