2 elegant ways to enable type checking for standalone browser script #3264
Labels
No Label
DBF
Dates
Defined Names
Features
Formula
HTML
Images
Infrastructure
Integration
International
ODS
Operations
Performance
PivotTables
Pro
Protection
Read Bug
SSF
SYLK
Style
Write Bug
good first issue
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sheetjs/sheetjs#3264
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
These two ways do not change any code logic. We don't need statements like
const XLSX = globalThis.XLSX;
orconst XLSX = window.XLSX;
.1.
Export as namespace in
types/index.d.ts
Then refer in script:
2.
Create a specific typing file
types.d.ts
:Then refer in script:
Thanks for sharing!
The original approach was based on a discussion from 2024 August -- to see it, you will need to join the SheetJS Discord Server
Your second approach is definitely better and we will be updating the docs to use it.
Unfortunately the
reference
workaround does not apply to HTML (see https://github.com/microsoft/vscode/issues/114115 ) but that bug has been reported to VSCode.