I integrate an adminLTE template in Angular 8. the first time when I launch the server the program works correctly after it gives this error - angular8

ERROR in src/assets/plugins/filterizr/FilterContainer.d.ts:1:10 - error TS2305: Module '"D:/angular_workspace/templateAngular/src/assets/plugins/filterizr/FilterizrOptions/defaultOptions
"' has no exported member 'RawOptionsCallbacks'.
1 import { RawOptionsCallbacks } from './FilterizrOptions/defaultOptions';
~~~~~~~~~~~~~~~~~~~
src/assets/plugins/filterizr/FilterItems.d.ts:1:10 - error TS2305: Module '"D:/angular_workspace/templateAngular/src/assets/plugins/filterizr/ActiveFilter"' has no exported member 'Filte
r'.
1 import { Filter } from './ActiveFilter';
~~~~~~
src/assets/plugins/filterizr/Filterizr.d.ts:4:10 - error TS2305: Module '"D:/angular_workspace/templateAngular/src/assets/plugins/filterizr/ActiveFilter"' has no exported member 'Filter'
.
4 import { Filter } from './ActiveFilter';
~~~~~~
src/assets/plugins/filterizr/Filterizr.d.ts:5:10 - error TS2305: Module '"D:/angular_workspace/templateAngular/src/assets/plugins/filterizr/FilterizrOptions/defaultOptions"' has no expor
ted member 'RawOptions'.
5 import { RawOptions } from './FilterizrOptions/defaultOptions';
~~~~~~~~~~
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
i 「wdm」: Failed to compile.

I got the same error when i tried to launch the server.
Replace imports in these classes:
"Filterizr.d.ts" in plugins/filterizr
Replace these imports:
import { Filter } from './ActiveFilter';
import { RawOptions } from './FilterizrOptions/defaultOptions';
For these:
import { Filter } from './types/index';
import { RawOptions } from './types/interfaces';
"FilterContainer.d.ts" in plugins/filterizr:
Replace this import:
import { RawOptionsCallbacks } from './FilterizrOptions/defaultOptions';
for:
import { RawOptionsCallbacks } from './types/interfaces';
"FilterItems.d.ts" in plugins/filterizr:
Replace this import:
import { Filter } from './ActiveFilter';
for
import { Filter } from './types';

Just remove the Filterizr folder from your plugins folder in assets
its useless for me and works

Filterizr plugin folder also contains the source code. Just keep the .js files and remove everything else inside /plugins/Filterizr folder. Remove .d.ts files. Problem solved.

Related

Cannot run expo web

I encounter the error 'Cannot access __fbBatchedBridgeConfig on web' when trying to run expo web
The instructions I got according to https://github.com/expo/fyi/blob/main/fb-batched-bridge-config-web.md was to do the following
Remove internal imports
You can remove the import altogether, or you can move an internal import inside of a platform specific block:
import getDevServer from "react-native/Libraries/Core/Devtools/getDevServer";
or
let getDevServer = () => { /* no-op */ }
if (Platform.OS !== 'web') {
getDevServer = require("react-native/Libraries/Core/Devtools/getDevServer");
+ }
However, I'm not sure where to insert this code. I've tried inserting it on my home page, on app.js, and I still encounter this error.
Could anyone help me out on this?
(I'm using EXPO 4.13.0, SDK 43 and react-native 0.64.3)
This error shows when you try to use a nested library from react-native.
Search specifically for react-native/ with your IDE in your project to find where you are importing such nested library.
There you can replace the offending import like:
import example from "react-native/example";
to:
let example = () => { /* no-op */ }
if (Platform.OS !== 'web') {
example= require("react-native/example");
}
You also need to import Platform like:
import { Platform } from 'react-native';
But note other errors might arise if you DO need to use that library, so also edit where you are using it.

How to access to subfolders in vue

I have below folders
src
-common
-> test.js
-views
->test
-1.vue
I need to call common folder in 1.vue.
I have tried below script, but its not working.
import { common } from '../common'
Is there any suggestion on how can I call common folder from 1.vue?
If test.js is a default export then:
import Test from '../../common/test';
If it's a named export then:
import { Test } from '../../common/test';

Circular dependency issue while exporting from single file using babel-module-resolver

I was working on a react native project and while perfoming hot reloading app goes into cyclic recursion resulting in maximum call stack exceeded. More details of this issue can be found here
From here I realised that there is something wrong and circular dependencies are getting created.
I decided to give madge a try and see whats going on in the project. After running the command I saw quite a number of circular dependencies.
Now since my project is quite huge debugging that was quite a task so I created a small version of my project containing a single folder.
I created a utils folder in which I have 4 files: -
utils/index.js
utils/device-helper.js
utils/init.js
index.js
For imports I am using babel-module-resolver
utils/init.js
import {deviceInfo} from "utils";
export const init = () => {
// initialising app and calling backend API with device info
};
utils/device-helper.js
import DeviceInfo from "react-native-device-info";
const API_LEVEL = "v0";
export const deviceInfo = () => {
try {
return Object.assign({}, {
apiLevel: API_LEVEL,
deviceId: DeviceInfo.getUniqueID(),
device: DeviceInfo.getDeviceName(),
model: DeviceInfo.getModel(),
osVersion: DeviceInfo.getSystemVersion(),
product: DeviceInfo.getBrand(),
country: DeviceInfo.getDeviceCountry(),
appVersion: DeviceInfo.getVersion(),
manufacturer: DeviceInfo.getManufacturer(),
userAgent: DeviceInfo.getUserAgent(),
buildNumber: DeviceInfo.getBuildNumber(),
bundleId: DeviceInfo.getBundleId()
});
} catch (e) {
// TODO: Report to Bugsnag
return {};
}
};
utils/index.js
export * from "./init";
export * from "./device-info-helper";
index.js
export * from "./utils";
After running madge command I get following :-
tests-MBP:madge-test harkirat$ madge --circular index.js
Processed 4 files (684ms)
✖ Found 1 circular dependency!
1) utils/index.js > utils/init.js
However, if i change utils/init.js to following it works:-
utils/init.js
import {deviceInfo} from "./device-helpers";
export const init = () => {
// initialising app and calling backend API with device info
};
I am not able to understand the cause of this circular dependency. Can someone please help?
Here is link to the repository.
I don't see a .babelrc in the repo, but here is what I think:
In utils/init.js you import using:
import {deviceInfo} from "utils";
That is same as:
import {deviceInfo} from "./utils/index";
In utils/index.js you do a export * from "./init". This export from basically first imports all the contents of ./utils/init and the reexports it.
So:
utils/init.js imports from ./utils/index
./utils/index.js imports from ./utils/init
There is your circular dependency.

Play Framework 2.2 - functional test fails with type mismatch

I've just upgraded to Play 2.2, and since the Helpers have changed, my test isn't compiling anymore.
import org.specs2.mutable.Specification
import play.api.test._
import play.api.test.Helpers._
import play.api.libs.ws._
import play.api.mvc.Results._
class ApplicationSpec extends Specification {
import controllers._
"Application" should {
"test WS logic" in new WithServer {
await(WS.url("http://localhost:3333").get()).status must equalTo(OK)
}
}
}
gives the following compile error
type mismatch;
[error] found : scala.concurrent.Future[play.api.libs.ws.Response]
[error] required: org.specs2.matcher.Matcher[?]
It's just a name clash between play.api.test.Helpers.await and org.specs2.matcher.FutureMatchers.await.
You could just refer to the play helper more explicitly (or rename your import):
Helpers.await(WS.url("http://localhost:3333").get()).status must equalTo(OK)
The following is probably better, however, which hasn't made it into the documentation yet:
https://github.com/playframework/playframework/blob/master/framework/src/play-test/src/main/scala/play/api/test/PlaySpecification.scala
So simply extend PlaySpecification instead of Specification in your test:
import org.specs2.mutable.Specification
import play.api.test._
import play.api.test.Helpers._
import play.api.libs.ws._
import play.api.mvc.Results._
class ApplicationSpec extends PlaySpecification {
import controllers._
"Application" should {
"test WS logic" in new WithServer {
await(WS.url("http://localhost:3333").get()).status must equalTo(OK)
}
}
}

Importing TypeScript Module located in path lower than current path throws Scope Error

In an attempt to put together an AMD-friendly TypeScript application skeleton, I've run into a snag: I can't seem to drop down from my current path to import a module in another directory. I can import modules that are above, but below throws an error:
TypeScript Error: The name ''../core/View'' does not exist in the current scope
Here the is the structure of my (very basic) app:
app/
- core/
- View.ts
- views/
- HomeView.ts
- Application.ts
In my Application.ts file, I can successfully import a module like so:
import HomeView = module( 'views/HomeView' );
export class Application {
constructor() {
console.log( 'initializing Application' );
}
}
Which, when using the --module AMD flag, correctly outputs
define(["require", "exports", 'views/HomeView'], function(require, exports, __HomeView__) {
var HomeView = __HomeView__;
var Application = (function () {
function Application() {
console.log('initializing Application', HomeView);
}
return Application;
})();
exports.Application = Application;
})
Now, the problem is when I jump into views/HomeView.js and attempt to import my core/View BaseClass to extend from:
import View = module('../core/View');
export class HomeView {
constructor() {
console.log('Hello HomeView!');
}
}
Which throws this complete error:
TypeScript Error: The name ''../core/View'' does not exist in the current scope
File: test/src/app/views/HomeView.ts
Start: 21, Length: 14
Line: import View = module('../core/View');
---------------------------^^^^^^^^^^^^^^--
Is this a bug in the compiler, or is my understanding of module imports faulty? Why would i be able to import views/HomeView, but not ../core/View?
Any help would be greatly appreciated.
I managed to get this to work using a root path - although I can't tell you why your relative path doesn't work.
import view = module("./app/core/View");