-
Notifications
You must be signed in to change notification settings - Fork 15
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
Integrated fixed test. #106
Integrated fixed test. #106
Conversation
Signed-off-by: Titian Cernicova-Dragomir <tcernicovad1@bloomberg.net>
Signed-off-by: Titian Cernicova-Dragomir <tcernicovad1@bloomberg.net>
Signed-off-by: Titian Cernicova-Dragomir <tcernicovad1@bloomberg.net>
Signed-off-by: Titian Cernicova-Dragomir <tcernicovad1@bloomberg.net>
Signed-off-by: Titian Cernicova-Dragomir <tcernicovad1@bloomberg.net>
Signed-off-by: Titian Cernicova-Dragomir <tcernicovad1@bloomberg.net>
Signed-off-by: Titian Cernicova-Dragomir <tcernicovad1@bloomberg.net>
Signed-off-by: Titian Cernicova-Dragomir <tcernicovad1@bloomberg.net>
Signed-off-by: Titian Cernicova-Dragomir <tcernicovad1@bloomberg.net>
ec46804
to
3936d4a
Compare
!!! error TS1005: ';' expected. | ||
function function(): void { } | ||
+ | ||
+!!! error TS9007: Declaration emit for this file requires type resolution. An explicit type annotation may unblock declaration emit. |
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.
This is a weird error, I guess we can detect this case and not print errors, on it WDYT?
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 don't think there is a good way to do this unless we are explicitly redetecting the syntax errors which is not something I would actually want to do. I will make a note to ask MS as well
+ Color, | ||
+ Thing = Color | ||
+ ~~~~~ | ||
+!!! error TS9007: Declaration emit for this file requires type resolution. An explicit type annotation may unblock declaration emit. |
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.
This looks wrong. Color should get assigned 0 by the constEvaluate
and thus Thing should also be zero if I try to recall the logic.
|
||
!!! error TS1146: Declaration expected. | ||
+ | ||
+!!! error TS9007: Declaration emit for this file requires type resolution. An explicit type annotation may unblock declaration emit. |
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.
We seem to have a general problem on reporting around ill-formed syntax. What do you think is the right way to go?
if (isStringLiteralLike(node)) { | ||
return factory.createStringLiteral(node.text); | ||
} | ||
|
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.
Nit: would it be better to make line breaks more consistent?
options.declaration = true; | ||
options.declarationMap = true; | ||
const emitHost = createEmitDeclarationHost(options, sys); | ||
export function transpileDeclaration(sourceFile: SourceFile, emitHost: IsolatedEmitHost) { |
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.
Please mark this @internal
. Every file reading in the typescript.d.ts
in will fail due to IsolatedEmitHost
being internal.
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.
We should discuss this. Is this a fully internal API? I would rather mark IsolatedEmitHost
as being public.
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 guess that's fine for me.
+ | ||
+ export const expr = (): void => {} | ||
+ ~~~~ | ||
+!!! error TS9007: Declaration emit for this file requires type resolution. An explicit type annotation may unblock declaration emit. |
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.
This shouldn't have triggered as it does have type annotation on the RHS.
- empty parameter.
- void as a return type.
Triggering TS9009 should be enough.
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.
Agreed. Made a node to fix in a follow on PER
...jsxNamespaceImplicitImportJSXNamespaceFromConfigPickedOverGlobalOne(jsx=react-jsx).d.ts.diff
Outdated
Show resolved
Hide resolved
!!! error TS1182: A destructuring declaration must have an initializer. | ||
~ | ||
!!! error TS7031: Binding element 'a' implicitly has an 'any' type. | ||
+ ~ |
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.
This is its own error - we should not report.
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.
We don't really do a lot of correlation between errors.
enum Foo { | ||
a = b | ||
+ ~ | ||
+!!! error TS9007: Declaration emit for this file requires type resolution. An explicit type annotation may unblock declaration emit. |
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.
oh, we seems not to support merged enum value assignments?
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.
No we don't they can merge across files which is something we definitely don't want.
// operand before - | ||
var NUMBER1 = var NUMBER: any-; //expect error | ||
+ | ||
+!!! error TS9007: Declaration emit for this file requires type resolution. An explicit type annotation may unblock declaration emit. |
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.
invalid syntax.
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.
Yeah. This test is too invalid. I did not review all of them yet.
Signed-off-by: Titian Cernicova-Dragomir <tcernicovad1@bloomberg.net>
if (diagnostics.length > 0) { | ||
throw new Error(`Cannot transform file '${sourceFile.fileName}' due to ${diagnostics.length} diagnostics`); | ||
} |
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 removed the throw here. The compiler does not generally throw errors on invalid code.
enum Foo { | ||
a = b | ||
+ ~ | ||
+!!! error TS9007: Declaration emit for this file requires type resolution. An explicit type annotation may unblock declaration emit. |
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.
No we don't they can merge across files which is something we definitely don't want.
// operand before - | ||
var NUMBER1 = var NUMBER: any-; //expect error | ||
+ | ||
+!!! error TS9007: Declaration emit for this file requires type resolution. An explicit type annotation may unblock declaration emit. |
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.
Yeah. This test is too invalid. I did not review all of them yet.
!!! error TS1182: A destructuring declaration must have an initializer. | ||
~ | ||
!!! error TS7031: Binding element 'a' implicitly has an 'any' type. | ||
+ ~ |
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.
We don't really do a lot of correlation between errors.
+ | ||
+ export const expr = (): void => {} | ||
+ ~~~~ | ||
+!!! error TS9007: Declaration emit for this file requires type resolution. An explicit type annotation may unblock declaration emit. |
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.
Agreed. Made a node to fix in a follow on PER
options.declaration = true; | ||
options.declarationMap = true; | ||
const emitHost = createEmitDeclarationHost(options, sys); | ||
export function transpileDeclaration(sourceFile: SourceFile, emitHost: IsolatedEmitHost) { |
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.
We should discuss this. Is this a fully internal API? I would rather mark IsolatedEmitHost
as being public.
!!! error TS1005: ';' expected. | ||
function function(): void { } | ||
+ | ||
+!!! error TS9007: Declaration emit for this file requires type resolution. An explicit type annotation may unblock declaration emit. |
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 don't think there is a good way to do this unless we are explicitly redetecting the syntax errors which is not something I would actually want to do. I will make a note to ask MS as well
+ export {Foo}; | ||
+ export default function Example(): void {} | ||
+ ~~~~~~~ | ||
+!!! error TS9009: Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function. |
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.
Not on this PR, but we should look at improving this. Noted
constEnums.ts(33,5): error TS9007: Declaration emit for this file requires type resolution. An explicit type annotation may unblock declaration emit. | ||
constEnums.ts(33,10): error TS2474: const enum member initializers must be constant expressions. |
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.
Yeah. I was working on this one.
export module C { | ||
export const enum E { | ||
V1 = 1, | ||
V2 = A.B.C.E.V1 | 100 |
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.
yes. we should porobably support it.
No description provided.