-
-
Notifications
You must be signed in to change notification settings - Fork 597
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
Updates typescript to 2.7.1 version #686
Changes from 2 commits
f3ed51a
ae7d356
56e86e6
eafe405
aa500d6
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 |
---|---|---|
|
@@ -3,10 +3,10 @@ import { isEmptyElement } from '../tagProviders/htmlTags'; | |
import { TextDocument } from 'vscode-languageserver-types'; | ||
|
||
export class Node { | ||
public tag: string; | ||
public closed: boolean; | ||
public endTagStart: number; | ||
public attributes: { [name: string]: string }; | ||
public tag!: string; | ||
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. 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. Since 2.7.1 it isn't allowed to declare properties without initialization when strict flag is set inside tsconfig. Typescript throws there error even though you null check that later. 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. You can declare it as optional or typing it as |
||
public closed!: boolean; | ||
public endTagStart!: number; | ||
public attributes!: { [name: string]: string }; | ||
public get attributeNames(): string[] { | ||
return Object.keys(this.attributes); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ export function getTagProviderSettings(workspacePath: string | null | undefined) | |
return settings; | ||
} | ||
try { | ||
const packagePath = ts.findConfigFile(workspacePath, ts.sys.fileExists, 'package.json'); | ||
const packagePath = ts.findConfigFile(workspacePath, ts.sys.fileExists, 'package.json') || ''; | ||
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. If package is not found, it should return early. Empty path doesn't make much sense. |
||
const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf-8')); | ||
if (packageJson.dependencies['vue-router']) { | ||
settings['router'] = true; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ export function testDSL(setup: CompletionTestSetup): (text: TemplateStringsArray | |
} | ||
|
||
export class CompletionAsserter { | ||
lastMatch: CompletionItem; | ||
lastMatch!: CompletionItem; | ||
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. It looks like But I'm fine with current writing since |
||
constructor(public items: CompletionItem[], public doc: TextDocument) {} | ||
count(expect: number) { | ||
const actual = this.items.length; | ||
|
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.
definitive assertion should add here. Getting sourceFile from declaration is expected to be non null.
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.
I think I doesn't get that.
getSourceFile
returnsts.SourceFile | undefined
in 2.7.1. To get rid of errors I had add to add exclamation mark on 298. It is not allowed to add it on line:col (296:25). Another solution is to add if with return statement.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.
I mean this. https://www.typescriptlang.org/play/#src=declare%20function%20str()%3A%20string%20%7C%20undefined%20%0D%0A%0D%0Avar%20a%20%3D%20str()!%0D%0A%0D%0Aa.toLowerCase