Skip to content

Improve type of Statement#parent#22052

Closed
ghost wants to merge 7 commits into
masterfrom
statement_parent
Closed

Improve type of Statement#parent#22052
ghost wants to merge 7 commits into
masterfrom
statement_parent

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Feb 20, 2018

Unfortunately, MissingDeclaration multiply inherits from DeclarationStatement and from three other types that aren't statements. So had to create a StatementOnly type for things that only occur in statement position.

Comment thread src/compiler/types.ts Outdated

/** Type for statements that appear only in statement position. */
export interface StatementOnly extends Statement {
parent?: Block | CaseClause | DefaultClause | SourceFile | ModuleBlock | LabeledStatement;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • IfStatement | WithStatement | IterationStatement

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also use BlockLike

@ghost ghost force-pushed the statement_parent branch from 7c33318 to 5b119d0 Compare February 22, 2018 23:04
@ghost ghost force-pushed the statement_parent branch from 5b119d0 to 6d46beb Compare February 22, 2018 23:05
@ghost
Copy link
Copy Markdown
Author

ghost commented Feb 22, 2018

No longer fixes #22027 as I have done that in #22131 instead.

Comment thread src/compiler/types.ts Outdated
}

/** Type for statements that appear only in statement position. */
export interface StatementOnly extends Statement {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we split off MissingDeclaration instead of having to create this type?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out MissingDeclaration has some supertypes it doesn't need. See #23485.

@typescript-bot
Copy link
Copy Markdown
Collaborator

Thanks for your contribution. This PR has not been updated in a while and cannot be automatically merged at the time being. For housekeeping purposes we are closing stale PRs. If you'd still like to continue working on this PR, please leave a message and one of the maintainers can reopen it.

@ghost ghost reopened this Nov 16, 2018
@ghost ghost assigned rbuckton Nov 16, 2018
@ghost ghost force-pushed the statement_parent branch from aefcf46 to 1aa7a32 Compare November 16, 2018 18:26
@RyanCavanaugh RyanCavanaugh deleted the statement_parent branch October 25, 2022 20:18
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants