Compile with --noImplicitThis#9580
Conversation
1. Add to various tsconfig.json 2. Add to Jakefile 3. Add annotations where needed. 4. Add workaround to shims.ts, which uses toplevel `this`.
|
The CI build pointed out that I failed to update the harness tsconfig.json -- Jake caught it because it uses the command line parameter instead of tsconfig.json |
| } | ||
|
|
||
| function Symbol(flags: SymbolFlags, name: string) { | ||
| function Symbol(this: Symbol, flags: SymbolFlags, name: string) { |
There was a problem hiding this comment.
@rakatyal just remembered your tslint rule would have issues with this because it can't distinguish between ts.Symbol and Symbol
|
I tested that the shims workaround to obtain global |
|
@weswigham I updated Gulpfile.ts with some defaults for tasks that use gulp-typescript's settings object instead of a tsconfig. Unfortunately, the one I wanted, |
|
There's a patch at the top of the Gulpfile adding in options |
|
Got it -- I added them. |
|
Do you want to add |
| leaf: function (relativeStart: number, relativeLength: number, ll: LineLeaf) { | ||
| leaf: function (this: ILineIndexWalker, relativeStart: number, relativeLength: number, ll: LineLeaf) { | ||
| if (!f(ll, relativeStart, relativeLength)) { | ||
| this.done = true; |
There was a problem hiding this comment.
Instead of giving this function a this type, can you not just replace this with walkFns (since it is just an object literal)?
|
Good idea, the output doesn't look much prettier than before, so I might be doing something wrong. |
|
Also, this PR fixes #9608. |
|
#9608 also mentions |
|
Never mind, the code's already there for |
|
|
||
| function emit(sourceFile?: SourceFile, writeFileCallback?: WriteFileCallback, cancellationToken?: CancellationToken): EmitResult { | ||
| function emit(this: Program, sourceFile?: SourceFile, writeFileCallback?: WriteFileCallback, cancellationToken?: CancellationToken): EmitResult { | ||
| return runWithCancellationToken(() => emitWorker(this, sourceFile, writeFileCallback, cancellationToken)); |
There was a problem hiding this comment.
Do you want to exchange this instance of this for program (which should be in scope)? Or is that excessive?
There was a problem hiding this comment.
Mmmmm...there's too much space between program and emit. I'm going to leave it. I don't think there's an easy solution, besides refactoring everything to use method syntax, which also has some bad side effects.
|
👍 With your discretion on my last comment. |
|
Please consider using an alternative to As far as I can understand, this is necessary to get the global object value without using |
|
@guncha would |
|
A PR is up at #11265 |
|
@sandersn it would fix the issue I've been seeing with Atom, thank you. |
|
Glad to hear it. This fix will ship with Typescript 2.1 |
--noImplicitThisto various tsconfig.json (gulp uses tsconfig).--noImplicitThisto Jakefile.this.Also, fixes #9608