GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Convert 'installTypesForPackge' refactor to a suggestion · Pull Request #22267 · microsoft/TypeScript

Conversation

@ghost

@ghost Deleted user (ghost) commented Mar 1, 2018

Copy link
Copy Markdown

In #19130, had to add duplicate code fix and refactor -- now it's just a code fix and we give a suggestion instead of error diagnostic if --noImplicitAny isn't enabled.

Note that I had to make a separate diagnostic for the suggestion; this is because each diagnostic is hard-coded with its category. It seems like we could base that on where the diagnostic is coming from instead? Something coming from the parser/checker is an error, something coming from computeSuggestionDiagnostics is a suggestion. This will be a bigger problem when I add suggestion diagnostics for unused variables, since we have a lot of different diagnostics for those.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Andy Hanson
Convert 'installTypesForPackge' refactor to a suggestion
ee304c3
@ghost
ghost requested review from Andrew Casey (amcasey) and Mohamed Hegazy (mhegazy) March 1, 2018 18:14
@ghost ghost changed the title Install types Convert 'installTypesForPackge' refactor to a suggestion Mar 1, 2018
mhegazy
Mohamed Hegazy (mhegazy) reviewed Mar 1, 2018
View reviewed changes
Comment thread src/compiler/program.ts Outdated
}
}

export function willAllowImplicitAnyJsModule(options: CompilerOptions): boolean {

@mhegazy Mohamed Hegazy (mhegazy) Mar 1, 2018

Copy link
Copy Markdown
Contributor

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.

/* @internal */

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@mhegazy Mohamed Hegazy (mhegazy) Mar 1, 2018

Copy link
Copy Markdown
Contributor

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.

consider moving this to untilities next to getAllowSyntheticDefaultImports and getStricitOptionValue

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
mhegazy
Mohamed Hegazy (mhegazy) reviewed Mar 1, 2018
View reviewed changes
Comment thread src/compiler/program.ts Outdated
return options.allowJs || !getStrictOptionValue(options, "noImplicitAny");
}

export function createDiagnosticForModuleMissingTypes(errorNode: Node, { packageId, resolvedFileName }: ResolvedModuleFull, moduleReference: string, diag: DiagnosticMessage): Diagnostic {

@mhegazy Mohamed Hegazy (mhegazy) Mar 1, 2018

Copy link
Copy Markdown
Contributor

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.

and here too /* @internal */

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@mhegazy Mohamed Hegazy (mhegazy) Mar 1, 2018

Copy link
Copy Markdown
Contributor

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.

consider moving them to utilities

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
mhegazy
Mohamed Hegazy (mhegazy) reviewed Mar 1, 2018
View reviewed changes
Comment thread src/compiler/diagnosticMessages.json Outdated
"category": "Suggestion",
"code": 80001
},
"Did not find a declaration file for module '{0}'. '{1}' implicitly has an 'any' type.": {

@mhegazy Mohamed Hegazy (mhegazy) Mar 1, 2018

Copy link
Copy Markdown
Contributor

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 probably should take your suggestion of converting an error diagnostic to a suggestion diagnostic.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
mhegazy
Mohamed Hegazy (mhegazy) reviewed Mar 1, 2018
View reviewed changes
Comment thread src/compiler/program.ts Outdated
}
function needAllowJs() {
return options.allowJs || !getStrictOptionValue(options, "noImplicitAny") ? undefined : Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type;
return willAllowImplicitAnyJsModule(options) ? undefined : Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type;

@mhegazy Mohamed Hegazy (mhegazy) Mar 1, 2018

Copy link
Copy Markdown
Contributor

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.

why do not we instead log the diagnostic in a different list, a suggestions list. the command line compiler will never report them, but we can query them in the services and add additional messages there as well..

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ghost
ghost force-pushed the installTypes branch from 532600c to ff2fd15 Compare March 1, 2018 20:55
Andy Hanson
Have checker collect a list of suggestion diagnostics instead of redo…
177a43c
…ing work in calculateSuggestionDiagnostics
@ghost
ghost force-pushed the installTypes branch from ff2fd15 to 177a43c Compare March 1, 2018 20:56
mhegazy
Mohamed Hegazy (mhegazy) approved these changes Mar 1, 2018
View reviewed changes
Andy Hanson added 2 commits March 1, 2018 13:02
Andy Hanson
Add comment
83245a1
Andy Hanson
Add diagnostic even with --allowJs
dcab26d
@ghost
ghost merged commit 16fc256 into master Mar 1, 2018
@ghost
ghost deleted the installTypes branch March 1, 2018 22:41
@microsoft Microsoft (microsoft) locked and limited conversation to collaborators Jul 3, 2018
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@amcasey Andrew Casey (amcasey) Awaiting requested review from amcasey

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@mhegazy
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.