Skip to content

Commit 97a6e0f

Browse files
authored
Update initMap function for type safety and accessibility
Try to get eslint to be happy again.
1 parent f28a5e8 commit 97a6e0f

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

  • samples/3d-accessibility-features

samples/3d-accessibility-features/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
// [START maps_3d_accessibility_features]
8-
async function initMap() {
8+
async function initMap(): Promise<void> {
99
// Import the needed libraries.
1010
const [{ Marker3DInteractiveElement, PopoverElement }, { PinElement }] =
1111
await Promise.all([
@@ -43,16 +43,16 @@ async function initMap() {
4343

4444
tourStops.forEach(({ position, title }, i) => {
4545
const pin = new PinElement({
46-
glyphText: `${i + 1}`,
46+
glyphText: String(i + 1),
4747
scale: 1.5,
4848
glyphColor: '#FFFFFF',
4949
});
5050
const popover = new PopoverElement();
5151

52-
const content = `${i + 1}. ${title}`;
52+
const content = `${String(i + 1)}. ${title}`;
5353
const header = document.createElement('span');
5454
// Include the label for screen readers.
55-
header.ariaLabel = `This is marker ${i + 1}. ${title}`;
55+
header.ariaLabel = `This is marker ${String(i + 1)}. ${title}`;
5656
header.slot = 'header';
5757

5858
popover.append(header);
@@ -74,5 +74,5 @@ async function initMap() {
7474
document.body.append(map3DElement);
7575
}
7676

77-
void init();
77+
void initMap();
7878
// [END maps_3d_accessibility_features]

0 commit comments

Comments
 (0)