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

chore: bump typescript dependency to 3.8 #1696

Merged
merged 1 commit into from Mar 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -74,9 +74,9 @@
"ts-jest": "^25.0.0",
"ts-node": "^8.5.0",
"tslint": "^5.20.1",
"typescript": ">=3.2.1 <3.8.0"
"typescript": ">=3.2.1 <3.9.0"
},
"resolutions": {
"typescript": "^3.7.2"
"typescript": "^3.8.3"
}
}
2 changes: 2 additions & 0 deletions packages/parser/tests/lib/__snapshots__/jsx.ts.snap
Expand Up @@ -651,6 +651,8 @@ Object {
}
`;

exports[`JSX useJSXTextNode: false fixtures/member-expression-private.src 1`] = `"Identifier expected."`;

exports[`JSX useJSXTextNode: false fixtures/member-expression-this.src 1`] = `
Object {
"$id": 1,
Expand Down
2 changes: 2 additions & 0 deletions packages/parser/tests/lib/__snapshots__/tsx.ts.snap
Expand Up @@ -50,6 +50,8 @@ Object {
}
`;

exports[`TSX fixtures/generic-jsx-member-expression-private.src 1`] = `"Identifier expected."`;

exports[`TSX fixtures/generic-jsx-opening-element.src 1`] = `
Object {
"$id": 1,
Expand Down
@@ -0,0 +1 @@
<this.#foo/>;
@@ -0,0 +1 @@
const foo = <this.#foo<string>/>
11 changes: 11 additions & 0 deletions packages/typescript-estree/src/convert.ts
Expand Up @@ -458,6 +458,12 @@ export class Converter {
let result: TSESTree.JSXMemberExpression | TSESTree.JSXIdentifier;
switch (node.kind) {
case SyntaxKind.PropertyAccessExpression:
if (node.name.kind === SyntaxKind.PrivateIdentifier) {
// This is one of the few times where TS explicitly errors, and doesn't even gracefully handle the syntax.
// So we shouldn't ever get into this state to begin with.
throw new Error('Non-private identifier expected.');
}

result = this.createNode<TSESTree.JSXMemberExpression>(node, {
type: AST_NODE_TYPES.JSXMemberExpression,
object: this.convertJSXTagName(node.expression, parent),
Expand All @@ -467,12 +473,14 @@ export class Converter {
) as TSESTree.JSXIdentifier,
});
break;

case SyntaxKind.ThisKeyword:
result = this.createNode<TSESTree.JSXIdentifier>(node, {
type: AST_NODE_TYPES.JSXIdentifier,
name: 'this',
});
break;

case SyntaxKind.Identifier:
default:
result = this.createNode<TSESTree.JSXIdentifier>(node, {
Expand Down Expand Up @@ -1570,6 +1578,9 @@ export class Converter {

case SyntaxKind.ExportDeclaration:
if (node.exportClause) {
if (node.exportClause.kind !== SyntaxKind.NamedExports) {
throw new Error('`export * as ns` is not yet supported.');
}
return this.createNode<TSESTree.ExportNamedDeclaration>(node, {
type: AST_NODE_TYPES.ExportNamedDeclaration,
source: this.convertChild(node.moduleSpecifier),
Expand Down
Expand Up @@ -5289,6 +5289,8 @@ Object {
}
`;

exports[`JSX useJSXTextNode: false fixtures/member-expression-private.src 1`] = `"Identifier expected."`;

exports[`JSX useJSXTextNode: false fixtures/member-expression-this.src 1`] = `
Object {
"body": Array [
Expand Down
Expand Up @@ -1555,6 +1555,15 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/member-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/member-expression-private.src 1`] = `
Object {
"column": 10,
"index": 10,
"lineNumber": 1,
"message": "Identifier expected.",
}
`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/member-expression-this.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/multiple-blank-spaces.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;
Expand Down Expand Up @@ -1627,6 +1636,15 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/tsx/generic-jsx-element.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/tsx/generic-jsx-member-expression-private.src 1`] = `
Object {
"column": 22,
"index": 22,
"lineNumber": 1,
"message": "Identifier expected.",
}
`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/tsx/generic-jsx-opening-element.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/tsx/react-typed-props.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;
Expand Down Expand Up @@ -1689,7 +1707,7 @@ Object {
"column": 14,
"index": 31,
"lineNumber": 2,
"message": "'await' expression is only allowed within an async function.",
"message": "'await' expressions are only allowed within async functions and at the top levels of modules.",
}
`;

Expand Down
Expand Up @@ -422,6 +422,8 @@ Object {
}
`;

exports[`TSX fixtures/generic-jsx-member-expression-private.src 1`] = `"Identifier expected."`;

exports[`TSX fixtures/generic-jsx-opening-element.src 1`] = `
Object {
"body": Array [
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -8152,10 +8152,10 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

typescript@*, "typescript@>=3.2.1 <3.8.0", typescript@^3.7.2:
version "3.7.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.5.tgz#0692e21f65fd4108b9330238aac11dd2e177a1ae"
integrity sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==
typescript@*, "typescript@>=3.2.1 <3.9.0", typescript@^3.8.3:
version "3.8.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061"
integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==

uglify-js@^3.1.4:
version "3.6.0"
Expand Down