You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current behavior
When importing a primereact Slider into a typescript file import { Slider } from 'primereact/slider'; compilation fails with error (1,1) Statements are not allowed in ambient contexts.
Expected behavior
Compilation should not fail.
Potential fix (Happy to put this in as a pull request if that helps.)
If I replace the contents of primereact/slider.d.ts with export * from 'primereact/components/slider/Slider';
then it compiles file. This is consistent with all other d.ts files I've seen.
cagataycivici
changed the title
slider.d.ts compile error "Statements are not allowed in ambient contexts."
slider.d.ts has wrong import syntax
Dec 24, 2018
I'm submitting a ...
Current behavior
When importing a primereact Slider into a typescript file
import { Slider } from 'primereact/slider';
compilation fails with error(1,1) Statements are not allowed in ambient contexts.
Expected behavior
Compilation should not fail.
Potential fix (Happy to put this in as a pull request if that helps.)
If I replace the contents of primereact/slider.d.ts with
export * from 'primereact/components/slider/Slider';
then it compiles file. This is consistent with all other d.ts files I've seen.
Minimal reproduction of the problem with instructions
In a .tsx file:
import { Slider } from 'primereact/slider';
tsconfig.json:
{ "compilerOptions": { "baseUrl": ".", "outDir": "build/dist", "module": "esnext", "target": "es5", "lib": [ "es6", "dom", "es2018" ], "sourceMap": true, "allowJs": true, "jsx": "react", "moduleResolution": "node", "rootDir": "src", "forceConsistentCasingInFileNames": true, "noImplicitReturns": true, "noImplicitThis": true, "noImplicitAny": true, "strictNullChecks": true, "suppressImplicitAnyIndexErrors": true, "noUnusedLocals": false, "allowSyntheticDefaultImports": true }, "exclude": [ "node_modules", "build", "scripts", "acceptance-tests", "webpack", "jest", "src/setupTests.ts" ], "include": [ "./src/**/*" ] }
Please tell us about your environment:
Windows 10, Visual Studio Code, npm
React version:
16.6.3
PrimeReact version:
2.0.1
Language:
TypeScript 3.2.1
The text was updated successfully, but these errors were encountered: