-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
chore: introduce TS path aliases for improved DX in v8 #25778
Changes from all commits
bd50e1e
ffbe82d
36b1502
d9d7bfd
7da8bea
4839fdb
d1b232c
5dde7c6
3427d4f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,15 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"extends": "../../tsconfig.base.v8.json", | ||
"compilerOptions": { | ||
"target": "es5", | ||
"outDir": "lib", | ||
"module": "commonjs", | ||
"jsx": "react", | ||
"declaration": true, | ||
"sourceMap": true, | ||
"experimentalDecorators": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"moduleResolution": "node", | ||
"preserveConstEnums": true, | ||
"strictNullChecks": true, | ||
"noImplicitAny": true, | ||
"lib": ["es6", "dom"], | ||
"types": ["webpack-env"], | ||
"skipLibCheck": true | ||
"lib": ["ES2015", "DOM"], | ||
"types": ["webpack-env", "node"] | ||
}, | ||
"include": ["src"] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ export interface ICategory { | |
// Exporting this object to be used in generating a TOC (table of content) for docs.microsoft documentation repo. | ||
// Any changes to this object need to be communicated to avoid accidental breaking of the documentation | ||
// and to allow the appropriate actions to be taken to mitigate this. | ||
export const categories: { Other?: ICategory; [name: string]: ICategory } = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. invalid type exposed by no strict null checks |
||
export const categories: { [name: string]: ICategory } = { | ||
'Basic Inputs': { | ||
Button: {}, | ||
Checkbox: {}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,7 +96,7 @@ export class Site<TPlatforms extends string = string> extends React.Component< | |
let platform = 'default' as TPlatforms; | ||
|
||
// If current page doesn't have pages for the active platform, switch to its first platform. | ||
if (Object.keys(navData.pagePlatforms).length > 0 && navData.activePages.length === 0) { | ||
if (Object.keys(navData.pagePlatforms!).length > 0 && navData.activePages!.length === 0) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all these nullable issues were exposed by no strict null checks, while using |
||
const firstPlatform = getPageFirstPlatform(getSiteArea(siteDefinition.pages), siteDefinition); | ||
const currentPage = getSiteArea(siteDefinition.pages); | ||
platform = firstPlatform; | ||
|
@@ -142,7 +142,7 @@ export class Site<TPlatforms extends string = string> extends React.Component< | |
const { siteDefinition } = this.props; | ||
|
||
// If current page doesn't have pages for the active platform, switch to its first platform. | ||
if (Object.keys(pagePlatforms).length > 0 && activePages.length === 0) { | ||
if (Object.keys(pagePlatforms!).length > 0 && activePages!.length === 0) { | ||
const firstPlatform = getPageFirstPlatform(getSiteArea(siteDefinition.pages), siteDefinition); | ||
this._onPlatformChanged(firstPlatform); | ||
} | ||
|
@@ -347,22 +347,19 @@ export class Site<TPlatforms extends string = string> extends React.Component< | |
return null; | ||
}; | ||
|
||
private _renderPlatformBar = (): JSX.Element | undefined => { | ||
private _renderPlatformBar = (): JSX.Element | null => { | ||
const { siteDefinition } = this.props; | ||
const { platform, pagePlatforms, hasPlatformPicker } = this.state; | ||
|
||
return ( | ||
hasPlatformPicker && | ||
Object.keys(pagePlatforms).length > 0 && ( | ||
<PlatformBar | ||
activePlatform={platform} | ||
onPlatformClick={this._onPlatformChanged} | ||
pagePlatforms={pagePlatforms} | ||
platforms={siteDefinition.platforms} | ||
innerWidth={appMaximumWidthLg} | ||
/> | ||
) | ||
); | ||
return hasPlatformPicker && Object.keys(pagePlatforms!).length > 0 ? ( | ||
<PlatformBar | ||
activePlatform={platform} | ||
onPlatformClick={this._onPlatformChanged} | ||
pagePlatforms={pagePlatforms} | ||
platforms={siteDefinition.platforms!} | ||
innerWidth={appMaximumWidthLg} | ||
/> | ||
) : null; | ||
}; | ||
|
||
/** | ||
|
@@ -500,7 +497,7 @@ export class Site<TPlatforms extends string = string> extends React.Component< | |
document.title = [ | ||
siteDefinition.siteTitle, | ||
siteArea, | ||
currPlatform && platforms[currPlatform]?.name, | ||
currPlatform && platforms![currPlatform]?.name, | ||
activePageName !== siteArea && activePageName, | ||
] | ||
.filter(Boolean) | ||
|
@@ -531,7 +528,7 @@ export class Site<TPlatforms extends string = string> extends React.Component< | |
this._jumpInterval = this._async.setInterval(() => { | ||
const el = document.getElementById(anchor); | ||
if (el || Date.now() - start > 1000) { | ||
this._async.clearInterval(this._jumpInterval); | ||
this._async.clearInterval(this._jumpInterval!); | ||
this._jumpInterval = undefined; | ||
if (el) { | ||
jumpToAnchor(anchor); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
node is needed because some v8 packages are relying on that global type existence (they are using
NodeJS.*
namespace which is exposed on global ifnode
types is present)