Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Definitions are not created #659

Open
Astra-RX opened this issue Mar 10, 2021 · 2 comments
Open

Definitions are not created #659

Astra-RX opened this issue Mar 10, 2021 · 2 comments

Comments

@Astra-RX
Copy link

Expected behavior:

Generate d.ts when { "declaration": true } assigned.

Actual behavior:

Only js files generated, tsconfig.json works fine with tsc directly.

Your gulpfile:

Include your gulpfile, or only the related task (with ts.createProject).

// tsc
const tsProject = ts.createProject('tsconfig.json')
function tsc() {
  const tsResult = tsProject.src().pipe(tsProject())

  return merge([
    tsResult.js,
    tsResult.dts
  ])
  .pipe(gulp.dest(ESM_DIR))
}

tsconfig.json

Include your tsconfig, if related to this issue.

{
  "compilerOptions": {
    "rootDir": "src",
    "outDir": "./.cache/",
    "target": "es6",
    "declaration": true,
    "jsx": "react-jsx",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "allowSyntheticDefaultImports": true,
    "removeComments": true,
    "sourceMap": true
  },
  "exclude": ["node_modules", "dist", "es", "development"],
  "include": ["typings.d.ts", "src"]
}

Code

Include your TypeScript code, if necessary.

Besides, I checked the tsProject() object, and found "declaration" within the "config" part is always false, no matter what the tsconfig.json or the setting param is.

Environment:
[email protected]
[email protected]
[email protected]

@Astra-RX
Copy link
Author

I dug the source a little and found the problem came from this line, but I don't see the reason why these options are related to the isolatedModules which is also not mentioned in official docs.

@TSMMark
Copy link

TSMMark commented Apr 10, 2022

isolatedModules: false saved me so much time, thank you @Artoria-0x04 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants