How to use the updateImportDeclaration function from typescript

Find comprehensive JavaScript typescript.updateImportDeclaration code examples handpicked from public code repositorys.

32
33
34
35
36
37
38
39
40
41
const sourceFileDir = path.dirname(sourceFile.path);
const abs = path.resolve(sourceFileDir, file);
if (/\.(less|css|scss|sass|svg|png|html)$/.test(file)) {
    const absSource = path.join(options.outDir, path.relative(options.baseUrl, sourceFileDir));
    const relFile = path.relative(absSource, abs).replaceAll(path.sep, '/');
    return ts.updateImportDeclaration(importNode, importNode.decorators, importNode.modifiers, importNode.importClause, ts.createStringLiteral(relFile));
}
if (/\.(json|tsx?|jsx?)$/.test(file))
    return;
if (fs.existsSync(abs + '.ts') || fs.existsSync(abs + '.tsx')) {
fork icon0
star icon2
watch icon1

+ 59 other calls in file

Other functions in typescript

Sorted by popularity

function icon

typescript.SyntaxKind is the most popular function in typescript (82777 examples)