CRITICAL: createFile from createVirtualTypeScriptEnvironment does not create a file detectable by it's own updateFile
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- tooling
Research direction
Start at packages/typescript-vfs/src/index.ts around line 72 and reproduce the example using createVirtualTypeScriptEnvironment, createFile, and updateFile. Trace why the newly created test.js is not found, then verify that updating it no longer throws the reported source-file error.
Written by the indexing model from the issue text.
Description
Page URL: https://github.com/microsoft/TypeScript-Website/blob/v2/packages/typescript-vfs/src/index.ts#L72
Issue: When calling updateFile on a newly created file, an error is thrown, stating Error: Did not find a source file for X. I believe the internal fs mapping does not get updated with the newly created files.
Here's an example:
import {
createDefaultMapFromCDN,
createSystem,
createVirtualTypeScriptEnvironment
} from '@typescript/vfs';
import ts from 'typescript';
const compilerOpts = {
target: ts.ScriptTarget.ES2021,
module: ts.ScriptTarget.ES2020,
lib: ['es2021', 'es2020', 'dom', 'webworker'],
esModuleInterop: true
};
const fsMap = await createDefaultMapFromCDN(
compilerOpts,
ts.version,
false,
ts
);
const ENTRY_POINT = 'index.ts';
fsMap.set(ENTRY_POINT, 'Hello World');
const system = createSystem(fsMap);
const env = createVirtualTypeScriptEnvironment(
system,
[ENTRY_POINT],
ts,
compilerOpts
);
env.createFile('test.js', 'test')
env.updateFile('test.js', 'hello world') // throws error
- Dominant language
- TypeScript
- Stars
- 2.6k
- Forks
- 1.5k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 5
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/TypeScript-Website
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
microsoft/TypeScript-Website#3611 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
microsoft/TypeScript-Website#3607 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
microsoft/TypeScript-Website#3039 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
microsoft/TypeScript-Website#2998 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 30/100
microsoft/TypeScript-Website#3650 ·
All issues in microsoft/TypeScript-Website
Similar issues
-
clawsweeper:linked-pr-open clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:message-loss issue-rating: 🦞 diamond lobster maturity:stable P2
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#616 ·
-
ZCode 3.14.3 に対応する Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
supermomonga/zcode-acp#24 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
growthbook/growthbook#7100 ·
-
triage
Difficulty 1/5 1-3 hours Newbie friendliness 88/100