fluent app: Can not import GlideSecureRandomUtil from @servicenow/glide typescript module

jusfory1
Tera Expert

hi all,

 

 I want to use GlideSecureRandomUtil api in my fluent app, but i can't import its type from the module, i found 

annother type SecureRandomUtil defined in that module, how to fix that?
//case 1: not type defination, record script include can invoke this api
import { GlideSecureRandomUtil } from '@servicenow/glide';
GlideSecureRandomUtil.getSecureRandomString()


//case 2:  has type defination,but record script include can't invoke, and show error SecureRandomUtil is undefined
import { SecureRandomUtil} from '@servicenow/glide';
SecureRandomUtil.getSecureRandomString()
devDependencies version:
"@servicenow/glide": "^26.0.1"
"@servicenow/sdk": "^3.0.1",
# sdk 
# fluent
1 ACCEPTED SOLUTION

BryceG
ServiceNow Employee
ServiceNow Employee

@jusfory Thanks for the feedback, we are actually in the process of fixing up the `@servicenow/glide` package so the next version will have this fixed.  The `SecureRandomUtil` is actually the `GlideSecureRandomUtil` just named improperly.
You can manually add a `servicenow-glide.d.ts` file to your project and add this patch for now to get past this

declare module "@servicenow/glide" {
 export class GlideSecureRandomUtil {
        static getSecureRandomInt(): number
        static getSecureRandomIntBound(bound: number): number
        static getSecureRandomLong(): number
        static getSecureRandomString(length: number): string

 }
}

 

View solution in original post

1 REPLY 1

BryceG
ServiceNow Employee
ServiceNow Employee

@jusfory Thanks for the feedback, we are actually in the process of fixing up the `@servicenow/glide` package so the next version will have this fixed.  The `SecureRandomUtil` is actually the `GlideSecureRandomUtil` just named improperly.
You can manually add a `servicenow-glide.d.ts` file to your project and add this patch for now to get past this

declare module "@servicenow/glide" {
 export class GlideSecureRandomUtil {
        static getSecureRandomInt(): number
        static getSecureRandomIntBound(bound: number): number
        static getSecureRandomLong(): number
        static getSecureRandomString(length: number): string

 }
}