Skip to content

Double Typescript compilation #70

Closed
@hatton

Description

@hatton

Using cosmiconfig-typescript-loader 4.3.0, my cosmic config setup has

const cosmic = Cosmic.cosmiconfig("docu-notion", {
      loaders: {
        ".ts": TypeScriptLoader(),
      },
      searchPlaces: [`docu-notion.config.ts`],
    });

In the same project, as a test, I have docu-notion.config.ts:

import {
  IDocuNotionConfig,
  IPlugin,
  NotionBlock,
} from "./dist/config/configuration";
import { verbose } from "./dist/log";

const dummyBlockModifier: IPlugin = {
  name: "dummyBlockModifier",

  notionBlockModifications: [
    {
      modify: (block: NotionBlock) => {
        verbose("dummyBlockModifier was called");
      },
    },
  ],
};

export const config: IDocuNotionConfig = {
  plugins: [dummyBlockModifier],
};

But at runtime, when I run my project using ts-node on my index.ts, I get

TypeScriptLoader failed to compile TypeScript:
docu-notion.config.ts:9:22 - error TS7006: Parameter 'block' implicitly has an 'any' type.

9             modify: (block) => {
                       ~~~~~
docu-notion.config.ts:10:18 - error TS2695: Left side of comma operator is unused and has no side effects.

Notice, for example, that the original had a type on block, but here in the error, it as if the typescript annotations were stripped away.

Any chance someone can see what I'm doing wrong here? If not I can work on a minimal repro.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions