Skip to content

Conversation

@Eric-Arellano
Copy link
Collaborator

Prework for #1256. It was confusing how we pass both tocModules: TocEntry[] and tocModulesByTitle: Dictionary<TocEntry>. It wasn't clear how those values relate, and Dictionary is an under-documented API by Lodash.

Also adds hasPrefix, which we will need in #1256.


if (itemModuleTitle) {
const itemModule = tocModulesByTitle[itemModuleTitle];
const itemModule = tocModulesByTitle.get(itemModuleTitle) as TocEntry;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can be confident .get() works because itemModuleTitle uses tocModuleTitles, which is all the .keys() of tocModulesByTitle.

Copy link
Member

@frankharkins frankharkins left a comment

Choose a reason for hiding this comment

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

Thanks! My initial confusion was working out why we were passing the same data in different forms. It makes sense now I know its for optimization, but this type hint helps too.

@Eric-Arellano Eric-Arellano added this pull request to the merge queue Apr 30, 2024
Merged via the queue into main with commit d9330b3 Apr 30, 2024
@Eric-Arellano Eric-Arellano deleted the EA/avoid-dictionary branch April 30, 2024 20:05
frankharkins pushed a commit to frankharkins/documentation that referenced this pull request Jul 22, 2024
Prework for Qiskit#1256. It was
confusing how we pass both `tocModules: TocEntry[]` and
`tocModulesByTitle: Dictionary<TocEntry>`. It wasn't clear how those
values relate, and `Dictionary` is an under-documented API by Lodash.

Also adds `hasPrefix`, which we will need in
Qiskit#1256.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants