GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Support 'import.meta' by DanielRosenwasser · Pull Request #23327 · microsoft/TypeScript Conversation
|
| } | ||
|
|
||
| interface ImportMeta { | ||
| [propertyName: string]: any; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
There is no way to opt out of this one... users who want strict definition can not undo the index signature. consider not adding it and letting say node.d.ts add it.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } | ||
|
|
||
| function walkTreeForExternalModuleIndicators(node: Node): Node { | ||
| return isAnExternalModuleIndicatorNode(node) ? node : forEachChild(node, walkTreeForExternalModuleIndicators); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This can accidentally pick up an import/export from an module augmentation as the current file's externalModuleIndicator if we're not careful.
declare module "foo" { import * as blah from "blah" } import.meta
Sorry, something went wrong.
There was an error while loading. Please reload this page.
331230d to
28f8d75
Compare
|
Heya, we are using stackblitz to host our documentation demos on our site before Google I/O, and we believe that we are blocked on this issue. Do you know which typescript release this fix would be included in? CC: Eric Simons (@EricSimons) Justin Fagnani (@justinfagnani) Relevant issues: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
2.9 would be our next feature release, which should be cut sometime near the end of May. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| // and possibly nested import statements in the future). | ||
| // Ideally the first few statements will be an import/export anyway. | ||
| sourceFile.externalModuleIndicator = | ||
| !(sourceFile.flags & NodeFlags.PossiblyContainsImportMeta) ? |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
i think this should be:
sourceFile.externalModuleIndicator = forEach(sourceFile.statements, isAnExternalModuleIndicatorNode) || getImportMetaNode(sourceFile); function isAnExternalModuleIndicatorNode(node: Node) { return hasModifier(node, ModifierFlags.Export) || node.kind === SyntaxKind.ImportEqualsDeclaration && (<ImportEqualsDeclaration>node).moduleReference.kind === SyntaxKind.ExternalModuleReference || node.kind === SyntaxKind.ImportDeclaration || node.kind === SyntaxKind.ExportAssignment || node.kind === SyntaxKind.ExportDeclaration ? node : undefined } function isImportMetaNode(node: Node) { return isMetaProperty(node) && node.keywordToken === SyntaxKind.ImportKeyword && node.name.escapedText === "meta"; } function walkTreeForExternalModuleIndicators(node: Node): Node { return isImportMetaNode(node) ? node : forEachChild(node, walkTreeForExternalModuleIndicators); } function getImportMetaNode(node: SourceFile) { return (sourceFile.flags & NodeFlags.PossiblyContainsImportMeta) ? walkTreeForExternalModuleIndicators(node) : undefined; }
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Please take a look at the checklist in https://github.com/Microsoft/TypeScript/wiki/Release-Activities#new-syntax-introduced. we need to add colorization support as well. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
We can get this in first and discuss relaxing the restriction after. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.