草庐IT

constant_tsc

全部标签

node.js - 如何用 `tsc` 和 `npm install` 解决鸡/蛋情况?

所以我有标准的文件夹结构dist/src/其中src有我的.ts文件,而dist有我的.js文件。(我的tsconfig.json文件中有"outDir":"dist",并且"includes"设置为'src')。注意'dist'在我的gitignore文件中,所以它不在版本控制中,所以当它转到Travis或CircleCI,在我运行tsc之前,dist文件夹中没有任何内容。这是问题-如果我先运行npminstall-它会失败,因为我的package.json中有这个:"bin":{"foo":"dist/cli.js"//dist/cli.jsdoesnotexistyet}但如果我

python - 从 cyptography.hazmat.bindings._constant_time 导入库导入错误

所以我正在尝试创建一个awslambda函数,以登录到一个实例并做一些事情。并且脚本在lambda之外运行良好,但是当我使用与https://aws.amazon.com/blogs/compute/scheduling-ssh-jobs-using-aws-lambda/相同的指令打包它时它不起作用。它会引发此错误。libffi-72499c49.so.6.0.4:cannotopensharedobjectfile:Nosuchfileordirectory:ImportErrorTraceback(mostrecentcalllast):File"/var/task/lambda

python - 错误信息 "python-pylint ' C0103 :Invalid constant name"

我对这张照片中的错误感到困惑:我不知道如何解决它们。我的程序是Python-Flask网络框架。当我使用VisualStudioCode调试我的程序时,Pylint会显示这些错误。我知道这个问题无关紧要,但它让我很恼火。我该如何解决?#-*-coding:utf-8-*-importsysfromflaskimportFlaskfromflask_bootstrapimportBootstrapfromflask_momentimportMoment#fromflask_wtfimportForm#fromwtformsimportStringField,SubmitField#fro

java - A Switch Java 问题 : case expressions must be constant expressions

我的switch/case语句有问题。错误说:“案例表达式必须是常量表达式”。我理解错误,我可以使用If解决它,但有人可以告诉我为什么case表达式必须在switch/case中保持不变。我的错误代码示例:publicbooleanonOptionsItemSelected(MenuItemitem){intidDirectory=((MenuItem)findViewById(R.id.createDirectory)).getItemId();intidSuppression=((MenuItem)findViewById(R.id.recycleTrash)).getItemId

Java Spring : Error message "no declaration can be found for element ' util:constant'

我正在尝试将util-constant用于ioc,但收到以下错误消息:cvc-complex-type.2.4.c:Thematchingwildcardisstrict,butnodeclarationcanbefoundforelement'util:constant'.Allofthespring3.1.1distjarsareinmyclasspathandIwasabletosuccessfullyrunmyprogrampriortomakingthechangesthatincludedtheuseoftheutil:constanttag.Here'smyiocxmlf

kotlin - kotlin中的java静态最终: Const 'val' initializer should be a constant value

在Java中,我们可以这样做:publicclassTestA{publicstaticfinalbooleanflag=true;publicstaticfinalStringstr=flag?"A":"B";//ok}但在Kotlin中不能classTestA{companionobject{constvalflag=trueconstvalstr=if(flag)"A"else"B"//err:Const'val'initializershouldbeaconstantvaluevalstr2=if(flag)"A"else"B"//ok,butnotequals[publics

c++ - 为什么会这样编译?期待 "cannot assign a constant to a non-const reference"

面试官给我看了这样的代码,问我是否可以编译,并给出我的推理。我非常肯定地告诉他它不会编译,因为10是一个常量,你不能将一个常量分配给一个非常量引用(比如int&b=10不会编译),而且,_a是一个临时变量,它也是再次考虑const,您不能使用非const引用来引用const变量。然而,当我回到家后,我惊讶地发现它可以完美地与所有可能的编译器一起编译。另外,我没有得到这份工作。我的哪一部分理解错了?classA{int&a;public:A(int_a):a(_a){}};intmain(){Aa(10);} 最佳答案 此代码没有“分

c++ - 警告 : ISO C++ forbids converting a string constant to ‘char*’ for a static `constexpr char*` data member

这个问题在这里已经有了答案:constexprconstvsconstexprvariables?(3个回答)关闭3年前。为什么这段代码会返回警告warning:ISOC++forbidsconvertingastringconstantto‘char*’[-Wwrite-strings]如果Aconstexprspecifierusedinanobjectdeclarationornon-staticmemberfunction(untilC++14)impliesconst.Aconstexprspecifierusedinafunctionorstaticmembervariab

c++ - __STDC_LIMIT_MACROS 和 __STDC_CONSTANT_MACROS 是什么意思?

我在系统的标准C++库以及我正在使用的库中的一些头文件中看到了这一点。这两个定义的语义是什么?除了源本身之外,还有像这样的#defines的好的引用吗? 最佳答案 __STDC_LIMIT_MACROS和__STDC_CONSTANT_MACROS是一种解决方法,允许C++程序使用C99标准中指定但不在C++标准。UINT8_MAX、INT64_MIN和INT32_C()等宏可能已经在C++应用程序中以其他方式定义。为了让用户决定是否要像C99那样定义宏,许多实现要求在stdint.h之前定义__STDC_LIMIT_MACROS和

c++ - 我什么时候会在 constexpr 上使用 std::integral_constant?

#include#includeintmain(){//creatinganintegralconstantwithconstexprconstexprunsignedintspeed_of_light{299792458};//creatinganintegralconstantwithstd::integral_constanttypedefstd::integral_constantspeed_of_light_2;//usingthemstd::coutstd::integral_constant有什么特别之处,我会选择使用它而不是constexpr?他们的行为和用例看起来和我