Skip to content

Commit

Permalink
[docs] Prefer linking API source TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Aug 15, 2021
1 parent 5314e42 commit f6e6151
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/src/modules/components/ApiPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ function ApiDocs(props) {
// convert things like `/Table/Table.js` to ``
.replace(/\/([^/]+)\/\1\.(js|tsx)$/, '');

// Prefer linking the .tsx or .d.ts for the "Edit this page" link.
const apiSourceLocation = filename.replace('.js', '.d.ts');

function createTocEntry(sectionName) {
return {
text: getTranslatedHeader(t, sectionName),
Expand Down Expand Up @@ -263,7 +266,7 @@ function ApiDocs(props) {
description={description}
disableAd={false}
disableToc={false}
location={filename}
location={apiSourceLocation}
title={`${componentName} API – Material-UI`}
toc={toc}
>
Expand Down

0 comments on commit f6e6151

Please sign in to comment.