Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document supported TypeScript version #305

Open
HoldYourWaffle opened this issue Nov 30, 2023 · 3 comments
Open

Document supported TypeScript version #305

HoldYourWaffle opened this issue Nov 30, 2023 · 3 comments
Assignees
Labels
Status: in backlog Issue is being tracked in the backlog but timeline for resolution is unknown Type: product question Question about Office Scripts

Comments

@HoldYourWaffle
Copy link
Contributor

HoldYourWaffle commented Nov 30, 2023

Article URL

Office Scripts Code Editor environment

Issue

The article listed above mentions that Office Scripts are written in TypeScript, but it doesn't mention which version.
Based on some trial and error I'm fairly confident that (as of Excel version 2310) it's TypeScript v3.7, but I'd love to see some official documentation on this :)

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP label Nov 30, 2023
@AlexJerabek
Copy link
Collaborator

Hi @HoldYourWaffle,

Thanks for this question. I'll reach out to the product team and get an answer for you.

@AlexJerabek AlexJerabek self-assigned this Nov 30, 2023
@AlexJerabek AlexJerabek added Status: under investigation Issue is being investigated Type: product question Question about Office Scripts and removed Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP labels Nov 30, 2023
@AlexJerabek
Copy link
Collaborator

Hi @HoldYourWaffle

The version of TypeScript used by Office Scripts is currently 4.0.3. We are currently looking at a way to update the *Script versions without risking breaking existing scripts. Given that this upgrade path is still undefined in the product, that we have a layer of additional TS restrictions for Office Scripts (some of which that limit the IntelliSense), and that the nature of Excel platforms and update channels complicates this whole conversation, we’re hesitant to document specific implementation details at this time. When this active discussion resolved, we’ll update the documentation accordingly.

@AlexJerabek AlexJerabek added Status: in backlog Issue is being tracked in the backlog but timeline for resolution is unknown and removed Status: under investigation Issue is being investigated labels Dec 2, 2023
@lionel-rowe
Copy link

lionel-rowe commented Jul 25, 2024

The version of TypeScript used by Office Scripts is currently 4.0.3. We are currently looking at a way to update the *Script versions without risking breaking existing scripts. Given that this upgrade path is still undefined in the product, that we have a layer of additional TS restrictions for Office Scripts (some of which that limit the IntelliSense), and that the nature of Excel platforms and update channels complicates this whole conversation, we’re hesitant to document specific implementation details at this time. When this active discussion resolved, we’ll update the documentation accordingly.

There are now lots of useful APIs available at runtime but missing TS types. In my smallish ~400-line script, I've had to resort to multiple hacks to get around this:

// let x = distances.at(-1)!
let x: number = distances['at'](-1)

// const obj = Object.fromEntries(...)
const obj: Record<string, string> = Object['fromEntries'](...)

// const settled = await Promise.allSettled(...)
const settled: ({ status: 'fulfilled', value: QueryResultData } | { status: 'rejected', reason: unknown })[] = await 
Promise['allSettled'](...)

// const result = results.findLastIndex(...)
const result = results['findLastIndex' as string as 'findIndex'](...)

// const locale = new Intl.Locale(...)
const locale: { language?: string, script?: string, region?: string } = new Intl['Locale'](...)

It'd be really nice to have access to the latest APIs in TS as well as at runtime, especially given the lack of any support.

If the upgrade path is complicated by backward compatibility concerns, is there any possibility of relaxing the type checking requirements? I.e. scripts with type checking errors still run, they just show squiggly lines in the editor (and maybe warnings in the console), much like running TypeScript code in Deno without the --check flag.

Edit: Also, maybe relaxing type checking requirements could unblock #318? 🤞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: in backlog Issue is being tracked in the backlog but timeline for resolution is unknown Type: product question Question about Office Scripts
Projects
None yet
Development

No branches or pull requests

3 participants