Files
memecoin-botV2/.pnpm-store/v10/files/f2/812f40a32c263901dd81bb7bcf1b97ca5eaf91065eb069fc755fd9f2cf0b45fcb6f4f5029e5f35a92be8cc751bb8227de38a94131ece61c102366c51289571

34 lines
1.7 KiB
Plaintext

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createParserServices = createParserServices;
function createParserServices(astMaps, program) {
if (!program) {
return {
emitDecoratorMetadata: undefined,
experimentalDecorators: undefined,
isolatedDeclarations: undefined,
program,
// we always return the node maps because
// (a) they don't require type info and
// (b) they can be useful when using some of TS's internal non-type-aware AST utils
...astMaps,
};
}
const checker = program.getTypeChecker();
const compilerOptions = program.getCompilerOptions();
return {
program,
// not set in the config is the same as off
emitDecoratorMetadata: compilerOptions.emitDecoratorMetadata ?? false,
experimentalDecorators: compilerOptions.experimentalDecorators ?? false,
isolatedDeclarations: compilerOptions.isolatedDeclarations ?? false,
...astMaps,
getContextualType: node => checker.getContextualType(astMaps.esTreeNodeToTSNodeMap.get(node)),
getResolvedSignature: node => checker.getResolvedSignature(astMaps.esTreeNodeToTSNodeMap.get(node)),
getSymbolAtLocation: node => checker.getSymbolAtLocation(astMaps.esTreeNodeToTSNodeMap.get(node)),
getTypeAtLocation: node => checker.getTypeAtLocation(astMaps.esTreeNodeToTSNodeMap.get(node)),
getTypeFromTypeNode: node => checker.getTypeFromTypeNode(astMaps.esTreeNodeToTSNodeMap.get(node)),
getTypeOfSymbolAtLocation: (symbol, node) => checker.getTypeOfSymbolAtLocation(symbol, astMaps.esTreeNodeToTSNodeMap.get(node)),
};
}