Providing typescript declaration file for external lib with Nx - nrwl-nx

This question has been asked and answered many different ways on Stack overflow and I think I've tried them all. This question is specific to getting it to work using #nrwl/nx.
The specific error is
TS7016: Could not find a declaration file for module 'libxmljs2-xsd'. '/Users/xyz/hpxml-gen/node_modules/libxmljs2-xsd/index.js' implicitly has an 'any' type.
Try `npm i --save-dev #types/libxmljs2-xsd` if it exists or add a new declaration (.d.ts) file containing `declare module 'libxmljs2-xsd';`
I've tried unsuccessfully:
Creating a global.d.ts file with declare module 'libxmljs2-xsd' in it.
Create index.d.ts file with declare module 'libxmljs2-xsd' and tried putting it at the root of the Nx lib, inside src and inside src/lib. None of those locations worked.
Modifying tsconfig.lib.json inside the root dir: "include": ["**/*.ts", "**/*.d.ts"]. I've also tried "include": ["**/*.ts", "index.d.ts"]
Created types/index.d.ts at root and in the root tsconfig.base.json added "typeRoots": ["node_modules/#types", "./types"]
I realize I can set "noImplicitAny": false but don't want to do that and lose a lot of the value of typescript.
I've spent a day on this thinking there has to be something simple I'm missing. I've searched stack overflow, all of the GitHub tickets and their documentation. Does anyone know how this works in Nx?

you should add the declaration: true inside your compilerOptions object declared inside your tsconfig.json file.
Refer the official docs for more info: https://www.typescriptlang.org/tsconfig#declaration

Related

i am getting error in odoo13 i setup new odooo i am try to install new custom modules

odoo/odoo/addons/base/models/ir_ui_view.py", line 592, in raise_view_error
raise ValueError(message)
ValueError: Field `invoice_is_snailmail` does not exist
Error context:
View `n/a`
[view_id: n/a, xml_id: n/a, model: n/a, parent_id: n/a]
I check in my code invoice_is_snailmail this files written in files but still odoo though an error
I am beginner in odoo developer. can you please answer.
The field invoice_is_snailmail is a field in standard Odoo module snailmail_account. If you want to use this field in your custom module, you need to install snailmail_account module first.
Best practice is to list the dependent module snailmail_account as a dependency in your module so that Odoo will install it automatically. More info on module definition and depends can be found here: https://www.odoo.com/documentation/13.0/reference/module.html, see manifest field depends.
If this does not help you, you need to provide more information in your question, e.g your source code for your custom module. Without your exact code it is hard to help more, see question guidelines at https://stackoverflow.com/help/how-to-ask.
Please Provide Code Screenshots or check fields define in py and xml in same module or field for xml in child module.

How to check if a file is already included?

I have a procedure structure like this:
<someprocedure.p>
<randomCode>
<INCLUDE standardIncludeFile.i>
</someprocedure>
The standardIncludeFile.i-include file can be used with any procedure files. However, it requires other include files to work. F.ex. stantarderror.i and standardconstants.i.
If the someprocedure.p already has included these 2 files, they shouldn't be included in the standardIncludeFile.i. If they're not, they should be included in the standardIncludeFile.i.
Can I use DEFINED inside the standardIncludeFile.i to check if those .i-files are already included in the someprocedure.p?
If I use INCLUDE anyway without any conditions, the Eclipse Open-Edge editor gives me the setting to include once, but I'm not sure if that's a good way. The files are compiled on the server for production, anyway.
Currently stantarderror.i or standardconstants.i do not contain any GLOBAL-DEFINED constants, so I cannot check them that way with DEFINED.
Within your incldue file, do something like this
&IF DEFINED (stantarderror) EQ 0 &THEN
GLOBAL-DEFINE stantarderror stantarderror
// actual code here
&ENDIF

Issue with a topjson object in a Meteor app built with coffeescript

Apologies for the lack of precision in the question, but I'm not completely sure which of possibly many things I'm doing wrong here.
I'm relatively new to Coffeescript and also geo applications in general, but here goes:
I've got a working (simple) Meteor (.7.0.1) application utilizing coffeescript in both client and server. The issue I'm having occurs when attempting to utilize TopoJSON encoded files to create a layer of US congressional districts. (the purpose of the app is to help highlight voter suppression in the US)
So, a few things: Typically in a non-Meteor app, I would just load the topoJSON file like so:
$.getJSON('./data/us-congress-113.json', function (data) {
var congress_geojson = topojson.feature(data, data.objects.districts);
congress_layer.addData(congress_geojson);
});
Now of course this won't work in Meteor because its not asynchronous.
One of the things that was recommended here on SO was to not worry about reading the file, and to instead change the json file to .js, and then set the contents (which are of course just an object) equal to a variable.
Here's what I did:
First, I changed the .json file to a .js file in the server directory, and added the "congress =" to the beginning of the file. It's a huge file so forgive me for omitting the whole object.
congress = {"type":"Topology",
"objects":
{"districts":
{"type":"GeometryCollection","geometries":[{"type":"Polygon"
Now here's where everything starts to give me issues:
In the server.coffee, I've created a variable like so to reference the congress object:
#congress_geojson = topojson.feature(congress, congress.objects.districts)
Notice how I'm putting the # symbol there? I've been told this allows a variable in Coffeescript to be globally scoped? I tried to also use a Meteor feature called "share" where I declare the variable as "share.congress_geojson". That led to the same issues which I will describe below.
Now in the client.coffee file, I'm trying to call this variable to load into a Leaflet map.
congress_layer = L.geoJson(null,
style:
color: "#DE0404"
weight: 2
opacity: 0.4
fillOpacity: 0.1
)
congress_layer.addData(#congress_geojson)
This isn't working, and specifically (despite attempts to find other ways, the errors I'm getting in the console are:
Exception from Deps afterFlush function: TypeError: Cannot read property 'features' of undefined
at o.GeoJSON.o.FeatureGroup.extend.addData (http://localhost:3000/packages/leaflet.js?ad7b569067d1f68c7403ea1c89a172b4cfd68d85:39:16471)
at Object.Template.map.rendered (http://localhost:3000/client/client.coffee.js?37b1cdc5945f3407f2726a5719e1459f44d1db2d:213:18)
I have no doubt that I'm missing something stupidly obvious here. Any suggestions or tips for what I'm doing completely wrong would be appreciated. Is it a case where an object globally declared in a .js file isn't available to code in a .coffee file? Maybe I'm doing something wrong on the Meteor side?
Thanks!
Edit:
So I was able to get things working by putting the .js file containing the congress object in a root /lib folder, causing the object to load first, and then calling the congress object from the client. However, I'm still wanting to know how I could simply share this object from the server? What is the "Meteor way" here?
If you are looking for the Meteor way to order the loading of files, use the Meteor.startup function and put the initialization code there. That function is the $.ready of the Meteor world, i.e., it will execute only after all your files have been successfully loaded on the client.
So in your case:
Meter.startup ->
congress_layer.addData(#congress_geojson)

How to resolve Unable to find file.cpp in path(s) in Marmalade?

I'm just trying to begin develop a game in Marmalade (6.3). But when I have made my new sources (.cpp, and .h) and added them to the mkb, and then trying to run my program, then I got an error which says that Unable to find file.cpp in path(s). It's for all of my files except the files (game.h, game.cpp, main.cpp) which were made by Marmalade when I have chosen the new 2D game project. Should I add my .cpp and .h files to anywhere else?
Thanks
It is difficult to give a categorical answer without more info. However my guess is that you've copied and pasted from an example and not understood about the syntax of the files section. Basically:
files
{
(foo)
humbug.cpp
)
The "(foo)" might look very innocent, but it actually says that humbug.cpp is actually in directory foo - relative to the mkb file. It is common practice to actually use "(source)" and put all the source files in a directory of that name - making the source layout a bit neater.
Naturally if you have (source) and don't put the files actually in directory source, they won't be found. My guess is that is what you are seeing.
Just to clarify previous answer, The format of files directive is like this -
files
{
(<Path relative to MKB>,<Alternate Path>)
["Name of the parent Group in VS/XCode project","Name of the subparent group"]
fileName.cpp
fileName.h
}
for example I have two files SoundManager.h and SoundManager.cpp in System folder of Source, while MainMenu.h and MainMenu.cpp in Source/UI. Now the files directive would be -
files
{
(Source/System)
["Source","System"] #This part is not required, it's just to arrange your files in IDE project
SoundManager.h
SoundManager.cpp
(Source/UI)
("Source","UI")
MainMenu.h
ManinMenu.cpp
}

How to add an extra plist property using CMake?

I'm trying to add the item
<key>UIStatusBarHidden</key><true/>
to my plist that's auto-generated by CMake. For certain keys, it appears there are pre-defined ways to add an item; for example:
set(MACOSX_BUNDLE_ICON_FILE ${ICON})
But I can't find a way to add an arbitrary property.
I tried using the MACOSX_BUNDLE_INFO_PLIST target property as follows: I'd like the resulting plist to be identical to the old one, except with the new property I want, so I just copied the auto-generated plist and set that as my template. But the plist uses some Xcode variables, which also look like ${foo}, and CMake grumbles about this:
Syntax error in cmake code when
parsing string
<string>com.bedaire.${PRODUCT_NAME:identifier}</string>
syntax error, unexpected cal_SYMBOL,
expecting } (47)
Policy CMP0010 is not set: Bad
variable reference syntax is an error.
Run "cmake --help-policy CMP0010"
for policy details. Use the
cmake_policy command to set the
policy and suppress this warning. This
warning is for project developers.
Use -Wno-dev to suppress it.
In any case, I'm not even sure that this is the right thing to do. I can't find a good example or any good documentation about this. Ideally, I'd just let CMake generate everything as before, and just add a single extra line. What can I do?
Have you looked into copying the relevant *.plist.in file in /opt/local/share/cmake-2.8/Modules (such as MacOSXBundleInfo.plist.in), editing it to put <key>UIStatusBarHidden</key><true/> (or #VAR_TO_REPLACE_BY_CMAKE#), and adding the directory of the edited version in the CMAKE_MODULE_PATH?
If you have CMake installed as an app bundle, then the location of that file is /Applications/CMake.app/Contents/share/cmake-N.N/Modules
You can add your values using # and pass #ONLY to configure_file.
Unfortunately there is no simple way to add custom line to generated file.